Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Word permutations - frustrated by lists.

  • To: mathgroup at
  • Subject: [mg71703] Re: Word permutations - frustrated by lists.
  • From: Bill Rowe <readnewsciv at>
  • Date: Mon, 27 Nov 2006 04:04:13 -0500 (EST)

On 11/26/06 at 5:49 AM, wookiz at (wooks) wrote:

>I seem to have a general problem with results that look right but
>for embedded lists. Here is an example of my problem. This is
>supposed to be a algorithm to generate all permutations of a string.

>arrangements[str_String /; StringLength[str] == 1] := {str};
>arrangements[str_String] := (Prepend[arrangements[StringJoin[
>Rest[#]]]], First[#]) & /@
>NestList[RotateRight, Characters[str], StringLength[str] - 1];

Here is a one line solution


For example


To reply via email subtract one hundred and four

  • Prev by Date: Re: draw vertical cylinder with no surface lines
  • Next by Date: Question about significant digits.
  • Previous by thread: Re: Word permutations - frustrated by lists.
  • Next by thread: Solving the cubic with Vieta's method