One View of Lazy Evaluation

From Simon Peyton Jones's interview in Coders At Work by Peter Siebel.

Lazy evaluation lets you write generators---his example is generate all the possible moves in your chess game---separately from your consumer, which walks over the tree and does alpha-beta minimaxing or something. Or if you're generating all the sequence of approximations of an answer, then you have a consumer who says when to stop. It turns out that by separating generators from consumers you can modularly decompose your program. Whereas, if you're having to generate it along with a consumer that's saying when to stop, that can make your program much less modular. Modular in the sense of separate thoughts in separate places that can be composed together. John's paper gives some nice examples of ways in which you can change the consumer or change the generator, independently from each other, and that lets you plug together new programs that would have been more difficult to get by modifying one tightly interwoven one.

Related Posts

Some ChatGPT Sessions

2016 ML thoughts

My biggest takeaway from Redwood Research REMIX

finite, actual infinity, potential infinity

Actions and Flows

PSA: reward is part of the habit loop too

a kernel of lie theory

The hyperfinite timeline

Slick hyperfinite Ramsey theory proof

Gaoxing Guy