[Haskell] rekursive array problem

Andreas Fuertig maillist at andieh.de
Mon May 2 13:31:41 EDT 2005


Hi @ all!

I have a big problem. 
i have a list of variables and now i need something like this

fillArray ["a"]
should be something like this:
[[("a",True)],[("a",False)]]

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

and so on. i tried many things, and i dont know how to solve this.

allthesame vars = [(alltrue [] vars)] ++ [(allfalse [] vars)]
alltrue liste [] = liste
alltrue liste (x:xs) = alltrue (liste ++ [(x,True)]) xs
allfalse liste [] = liste
allfalse liste (x:xs) = allfalse (liste ++ [(x,False)]) xs

this works, but whats with the rest :)

it would be very nice, if somebody could help me.

thank you
Andreas


More information about the Haskell mailing list