[Haskell-cafe] Re: Quick question for a slow program
lanny at cisco.com
Sun Jun 8 18:21:45 EDT 2008
At least when I teased apart why the first one worked it looked
heap-like. Each step of the foldr pulled off the smallest nonprime
and merged the next two lists guaranteeing that the next smallest
nonprime would be at the head of the next step.
Can't argue with results though. The version you have up is about
twice as fast as the old one (if a bit harder to read).
> Lanny Ripple wrote:
>> The second prime generator on this page
>> is quick and easy. I keep it nearby for all those sudden attacks of
>> needing to solve yet another projecteuler problem.
> The second prime sieve did not create an implicit heap as advertised.
> I've fixed that and also cleaned up the page a bit, moving this sieve to
> the section "Implicit Heap".
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe