[Haskell-Cafe] Quick question for a slow program

David MacIver david.maciver at gmail.com
Sat Jun 7 13:18:15 EDT 2008


On Sat, Jun 7, 2008 at 10:26 AM, Slavomir Kaslev
<slavomir.kaslev at gmail.com> wrote:
> Hello,
>
> I was just brushing my haskell-fu skills writing a solution for Google
> Treasure Hunt Problem 4. Hers is what it looks like:
>
>> primes = sieve [2..]
>>     where
>>       sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p /= 0]

Read this: www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf

This is probably the biggest culprit in your code. :-)


More information about the Haskell-Cafe mailing list