Lecture: Lazy Evaluation

Background Material

Reading

Theme

In this lecture we revisit alternative orders of function evaluation and streams. We examine the benefits of normal order over applicative order. We present a modified version of scheme that uses normal order and show how to modify the metacircular interpreter to support lazy evaluation. While applicative order is more commonly used, due to its efficiency, a technique called memoization can be used to improve performance of languages with normal order. In the interpreter with normal order evaluation lists and streams are identical.

Even more important than "normal order" scheme and lazy evaluation is the notion that interpreters can be used to investigate alternative language design choices and language implementations.

Topics

  1. Review substitution model of computation and applicative vs. normal order of evaluation
  2. Review streams
  3. Implementation of streams (modification of metacircular interpreter)
  4. Variant of scheme with lazy evaluation
  5. Modification of metacircular interpreter to support lazy evaluation

Programs

references

Exercises

Created: May 20, 2009 (modified April 19, 2012) by jjohnson AT cs DOT drexel DOT DOT edu