Henning Thielemann wrote: > combinations = foldr (Monad.liftM2 (:)) [[]]
Lennart Augustsson wrote:
combinations [] = [[]] combinations (xs:xss) = liftM2 (:) xs (combinations xss)
List comprehension is faster when compiled with ghc-6.4.2 -O: combinations [] = [[]] combinations (xs:xss) = [ x:y | x <- xs, y <- combinations xss ] BTW, I think 'cross_many' would be a better name. -- -- Mirko Rahn -- Tel +49-721 608 7504 -- --- http://liinwww.ira.uka.de/~rahn/ --- _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe