
6 Jun
2006
6 Jun
'06
9:12 a.m.
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/ ---