How can I make a generic permutations function?

-- boolean permutations
bpms :: Int → [[Bool]]
bpms 0 = [[]]
bpms n = map (False:) bss ++ map (True:) bss
         where
           bss = bpms (n - 1)

-- generic permutations
pms a :: Int → [[a]]

Best Regards,
Cetin Sert
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to