|Playlist||schedule page slides as PDF|
Lazy 1 — intro (4:24)
PLAI§17.1 Motivating lazy evaluation, as opposed to eager evaluation.
Lazy 2 — using lazy Plait (3:26)
Demonstrating lazy evaluation via Plait’s #:lazy mode.
Lazy 3 — state and laziness (1:26)
An illustration of problem of mixing state and lazy evaluation, with the conclusion that a lazy language should be purely functional.
Lazy 4 —
Running the lambda.rkt interpreter in Plait’s lazy mode, which turns Curly into a lazy language.
Lazy 5 —
Running the letrec-ubi.rkt interpreter in Plait’s lazy mode, which doesn’t work, since the interpreter implementation uses state. The repair is to get rid of state in the implementation and double down on laziness; see letrec-mc-lazy.rkt.
Lazy 6 — lazy interp (4:05)
Instead of relaying on Plait’s lazy mode, we introduce delay and adjust the environment to hold delayed expressions. See lazy.rkt.
Thanks to Julien Provillard for greatly improving the presentation and implementation here.
Lazy 7 — more lazy (3:03)
Our implementation of a lazy language turns out to be unrealistic, because it evaluates expressions multiple times.The problem can be fixed by caching the value of a delayed expression, so that the cached value can be used if it is demanded again. See more-lazy.rkt.
Lazy 8 — terminology (1:15)
A brief summary of additional terminology that you may encounter related to lazy and eager evaluation.