David Benbennick | 19 Dec 01:27
Picon

Re: Add 'subsequences' and 'permutations' to Data.List (ticket #1990)

On Dec 18, 2007 12:56 PM, Bertram Felgenhauer
<bertram.felgenhauer <at> googlemail.com> wrote:
> finally, we could make it slightly more lazy

Good point, your version is much better.

The same issue applies to permutations.  I haven't had time to write
out the code yet, but I can imagine a version of permutations that
does:

permutations [1..] =
[1...],
[2,1,  ...],
[1,3,2 ...],
[2,3,1 ...],
[3,1,2 ...],
[3,2,1 ...],
...

so that the expression (take 10 $ map (take 10) $ permutations [1..])
isn't bottom.

Gmane