[Haskell-cafe] Re: Quick question for a slow program

Lanny Ripple 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).

  -ljr

apfelmus wrote:
> Lanny Ripple wrote:
>> The second prime generator on this page
>>
>>    http://www.haskell.org/haskellwiki/Prime_numbers
>>
>> 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".
> 
> 
> Regards,
> apfelmus
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list