9 Mar
2008
9 Mar
'08
3:52 p.m.
Exercise: Show how the single comprehension [(x,y) | x <- [1,2,3], y <- [4,5,6]] with two generators can be re-expressed using two comprehensions with single generators. Hint: make use of the library function _concat_.
Another hint: it can be rewritten as concatMap (\x -> concatMap (\y -> [(x,y)]) [4,5,6]) [1,2,3]