[Haskell-cafe] Re: MonadFix

Joost Behrends webmaster at h-labahn.de
Fri Dec 21 08:08:50 EST 2007


please read my code. I introduced DivIter to separate divstep from divisions.
But it stores intsqrt dividend also. Thus the sqrt is only recomputed, when a
new factor is found.

Concerning primes': With the sieve of Eratosthenes we cannot make a lazy list,
we need the whole list at any point of computation. And beyond the end we fall
back to x -> x+2.

This is the difference to the list of summands i proposed. And we have the
arbitrary choice of [2,4], [2,4,2,4,2,4,2,6,2,6] or any longer.

Concerning State: There is useful instruction by Ryan Ingram too here. I will
study that and yours. Thank you !

Cheers, Joost

More information about the Haskell-Cafe mailing list