On 26 Jan 2008, [EMAIL PROTECTED] wrote: > The problem you solved can be solved much more elegantly: > > pms : [a] -> Int -> [[a]] > pms xs n = foldM combine [] (replicate n xs) where > combine rest as = liftM (:rest) as > > or, for the unreadable version: > pms xs n = foldM (map . flip (:)) [] $ replicate n xs
or, if you don't mind getting the elements in a different order: replicateM 3 [True,False] Jed
pgpzEX8m8FfH4.pgp
Description: PGP signature
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
