
8 Mar
2010
8 Mar
'10
9:50 a.m.
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