
11 May
2011
11 May
'11
7:46 a.m.
On Wed, 11 May 2011 13:36:30 +0200, Hamster
If I change the function to look like:
combinations xs ys = [ (x,y) | x <-[xs], y<-[ys]]
The output changes to: [([1,2,3],[1,2,3])]
I don't understand what's going on there. Is there any way I can get it to produce all the combinations of a user supplied list?
Change the function to: combinations xs ys = [ (x,y) | x <- xs, y <- ys] xs and ys are already lists; if you put square brackets around them, you get a list with another list as the only element. Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html --