[Haskell-cafe] Looking for the fastest Haskell primes algorithm

Dan Weston westondan at imageworks.com
Thu Apr 16 22:42:36 EDT 2009

Unless primesUpTo n goes from highest to lowest prime (ending in 2), I 
don't see how sharing is possible (in either space or time) between 
primesUpTo for different n.

Is it intended that the primes should therefore be listed in descending 

ajb at spamcop.net wrote:
> primes :: [Integer]
> isn't as useful as you might think for a library, because it must, by
> definition, leak an uncontrolled amount of memory.  This:
> primesUpTo :: Integer -> [Integer]
> is a better interface in that respect.

More information about the Haskell-Cafe mailing list