Generating the n! permutations in Haskell

Koen Claessen koen@cs.chalmers.se
Mon, 10 Jun 2002 10:11:52 +0200 (MET DST)


I wrote:

 | permutations :: [a] -> [[a]]
 | permutations xs =
 |   [ y : zs
 |   | (y,ys) <- selections xs
 |   , zs     <- permutations ys
 |   ]

... and of course my cut-and-paste technology produced a
message that has a built-in find-the-missing-base-case
puzzle!

:-)

/K