[Haskell-beginners] Translating a while

Yitzchak Gale gale at sefer.org
Mon Mar 8 09:50:18 EST 2010


Daniel Fischer wrote:
> When working with lists, one would typically not produce the next
> permutation from the previous, but generate the list of all permutations
> (take a look at the code of "permutations" in Data.List).

And even if you do need to use the classic "produce the
next permutation from the previous" algorithm, with Haskell
lists it would be more convenient to work from the beginning
of the list rather than the end, if possible. That produces
the permutations in "reverse dictionary" order instead of
dictionary order though. In a "reverse dictionary", the words
are ordered by looking at the last letter, then the previous letter,
etc.

Regards,
Yitz


More information about the Beginners mailing list