Wednesday, May 10, 2006

Just for the record, worked like a charm after I got around some pesky type issues. So satisfying!
module Main where

main = print (permute "abcd")

permute :: [Char] -> [[Char]]
permute [] = [[]]
permute (l) = [a:x | a <- l, x <- permute(filter (/= a) l)]

No comments:

Post a Comment