[Haskell-beginners] list doesn't end
Oliver Charles
ollie at ocharles.org.uk
Sat Nov 23 18:42:05 UTC 2019
How big are those lists? GHC will not be able to work out x+y+z < 50 will
never be true again, it will have to exhaustively consider *every*
combination.
On Sat, 23 Nov 2019, 6:38 pm Alexander Chen, <alexander at chenjia.nl> wrote:
> Hi,
>
> I am doing some further learning with euler now in Haskell instead of
> Julia. But I am getting something strange.
>
> [x+y+z | x <- a2, y <- b3, z <- c4, (x+y+z) < 50]
>
> a2, b3, c4 are all finite lists derived from the lazy list of the primes
> package. the output is:
>
> [28,47,33,49
>
> this is not a typo it is still calculating hence the missing bracket (for
> the last couple of hours, when to a christmas fair in between). The only
> thing is that, this should be the answer:
>
> [28,47,33,49]
>
>
> so it should be done but its not. what am I doing wrong?
>
> best,
>
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20191123/151c94ae/attachment.html>
More information about the Beginners
mailing list