[Haskell-cafe] list comprehension doesn't work

Brandon Allbery allbery.b at gmail.com
Tue May 14 17:22:15 CEST 2013


On Tue, May 14, 2013 at 11:17 AM, John <knowledge1202 at gmail.com> wrote:

> listPairs = [(a*b, y) | a <- [0..], b <- [0..], (a*b) > 5, (a*b) < 500,
> (y*y) < 1001, mod y x == 0]
>
> Now I have it as you said, however the compiler complains about all y and x
> and says they are NOT in scope.
>
> Why is it so? I can't see any problem with that...
>

I don't see any definitions of x or y there. (Note that you have replaced x
with a*b.)

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130514/b0871137/attachment.htm>


More information about the Haskell-Cafe mailing list