---
title: "One View of Lazy Evaluation"
canonical: "/2017/01/07/one-view-of-lazy-evaluation/"
date: "2017-01-07"
author: "Alok Singh"
tags: []
---


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.
