[Haskell-cafe] simple Haskell question - List comprehensions
miguelimo38 at yandex.ru
Sun Mar 9 15:52:30 EDT 2008
> 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]
More information about the Haskell-Cafe