
From: Benjamin Franksen
Date: Wed, 4 May 2005 22:47:21 +0200 On Wednesday 04 May 2005 22:22, karczma@info.unicaen.fr wrote:
Bryce Bockman writes:
Scheme is strict, so it lacks some of the flexibility (and drawbacks) that come from Laziness, but in the book they teach you how to build a Lazy version of Scheme, which is instructive in understanding what's really going on in Lazy evaluation.
Don't confuse categories please. SICP doesn't say how to make a lazy variant of Scheme. Applicative protocol is not normal protocol, the reduction is, as it is.
We may have a different copy of SICP, but in mine (2nd edition) there is Chapter 4.2 "Variantions on a Scheme -- Lazy Evaluation" and in particular 4.2.2 "An Interpreter with Lazy Evaluation".
Ben
To be completely accurate: the evaluation order is Scheme is strict, not lazy, forever and ever, amen. That doesn't change. What SICP shows you how to do in chapter 4 (brilliantly, I think) is how to write a "metacircular evaluator" which is a Scheme interpreter written in Scheme itself. Of course, because you have a Scheme interpreter running on top of another Scheme interpreter, the (outer) interpreter is going to be pretty slow, but the point of the chapter is not to build a useful interpreter but to really understand how interpreters work. Once you understand that, they show that it's relatively easy to build a different kind of Scheme interpreter, one that uses lazy evaluation instead of strict evaluation. That's not "real Scheme" by any means, but it can be used to do real computations. Check out http://mitpress.mit.edu/sicp for the whole story. We now return you to your regularly-scheduled language... Mike