
Hi,
Why not keep things simple and just write a pure function?
permute :: [a] -> [[a]] permute xs = [s:ps | (s,ss) <- select xs, ps <- permute ss]
select :: [a] -> [(a,[a])] select [] = [] select (x:xs) = (x,xs) : [(s,x:ss) | (s,ss) <- select xs]
When I run this in ghci I always get an empty list: [patrickl@fc9i386 haskell]$ ghci permute.hs GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. [1 of 1] Compiling Main ( permute.hs, interpreted ) Ok, modules loaded: Main. *Main> permute [1,2,3] [] Am i missing something? Patrick
Bob _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- ===================== Patrick LeBoutillier Rosemère, Québec, Canada