alex: > This implementation of calculating 10000 primes (compiled with GHC -O2) > is 25% slower than the naive python implementation. Shouldn't it be > faster? Am I doing something obviously stupid?
Why not just: primes = sieve [2..] sieve (p : xs) = p : sieve [x | x <- xs, x `mod` p > 0] main = print (take 1000 primes) That's super naive, and seems to be around 5x faster than the code you were trying. (So make sure you're doing the same thing as the python version) -- Don _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe