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@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe