[Haskell-cafe] Why doesn't laziness save the day here?

Stephen Tetley stephen.tetley at gmail.com
Tue Jan 5 03:34:35 EST 2010


2010/1/5 Dale Jordan <dalej at alum.mit.edu>:

> The motivation for iterateR is to be able to have the ultimate
> consumer determine how many random values to force, but still have a
> single random generator used throughout the computation.


Hi Dale

If you want the producer and consumer to run at different speeds with
something in-between to synchronize them (velomorphisms anyone?), you
might want to look at Jeremy Gibbons's spigot algorithm for pi and
also his metamorphisms paper.


http://www.comlab.ox.ac.uk/oucl/work/jeremy.gibbons/publications/spigot.pdf
http://www.comlab.ox.ac.uk/oucl/work/jeremy.gibbons/publications/metamorphisms-scp.pdf

That said, I've personally found it hard to frame code in the spigot
style so I couldn't readily offer any tips on the code you've
presented.

Best wishes

Stephen


More information about the Haskell-Cafe mailing list