[Haskell-cafe] list comprehension doesn't work
Danny Gratzer
danny.gratzer at gmail.com
Tue May 14 17:20:40 CEST 2013
Well you've deleted the portion of the code referring to x and y.
listPairs = [(a*b, y) | y <- [0..], a <- [0..], b <- [0..], (a*b) > 5,
(a*b) < 500, (y*y) < 1001, mod y (a*b) == 0]
This will still never terminate however.
On Tue, May 14, 2013 at 10:17 AM, John <knowledge1202 at gmail.com> wrote:
> thanks to both!
>
> 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...
>
>
>
>
> --
> View this message in context:
> http://haskell.1045720.n5.nabble.com/list-comprehension-doesn-t-work-tp5730158p5730161.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
--
Danny Gratzer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130514/6d0381f4/attachment.htm>
More information about the Haskell-Cafe
mailing list