
14 Mar
2010
14 Mar
'10
4:38 p.m.
The first question is "what does 'all the combinations' actually MEAN?" We are told that f [a,b,c] [d,e,f] [g,h,i] = [[(a,d,g),(b,e,h),(c,f,i)], ...] in which the first element of the result is just zip3 [a,b,c] [d,e,f], [g,h,i]. But what are the other elements? Why is "all the combinations" a list of lists of tuples rather than a list of tuples? At first I thought you were after f xs ys zs = [(x,y,z) | x <- xs, y <- ys, z <- zs] because that's what I would mean by "all the combinations", but the example shows that's not so. When you can explain clearly what you mean by "all the combinations", the code won't be far away.