[Haskell-beginners] Why does this list comprehension return an empty list?
ky3 at atamo.com
Wed Jul 24 02:47:24 CEST 2013
On Tue, Jul 23, 2013 at 3:53 PM, Costello, Roger L. <costello at mitre.org>wrote:
> Also, how would I modify this:
> [(a,b) | a <- f xs, b <- g xs]
> so that it produces this:
Try: [(a,b) | a <- f xs | b <- g xs]
Note the 2nd parallel bar. You may have to enable a Parallel List
Comprehension pragma or somesuch.
Everyone else has given great explanations about your curious definitions
of f and g and why the original does what it does. Well worth looking into.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners