Andreas Fuertig wrote:

fillArray ["a"]
[[("a",True)],[("a",False)]]

fillArray ["a","b"]
[[("a",True),("b",True)],[("a",False),("b",True)],[("a",True),("b",False)],
[("a",False),("b",False)]]

A simple solution is:

fill :: [a] -> [[(a,Bool)]]
fill [] = [[]]
fill (x:xs) = do v <- [True,False] ; vs <- fill xs ; return ((x,v):vs)

have fun,

--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to