Playlist | schedule page slides as PDF |
Letrec 1 — encoding redux (1:00)
Our encoding of letrec works for functions, but it’s not as general as letrec in Plait.
Letrec 2 — letrec (4:28)
A closer look at letrec and how it might be implemented in terms of Plait’s letrec.
Letrec 3 — metacircular interp (3:41)
Filling in interp and trying it out. See letrec-mc.rkt. The term metacircular refers to the idea of implementing a feature using the same feature in the implementation language—as we have done before, and in this case, implementing letrec using letrec.
Letrec 4 — problem with metacircular (3:21)
A metacircular implementation can tell us some things, but usually want to move on. In this case, we especially want to take control of the behavior of interp when a variable is referenced before its initialization.
Letrec 5 — recursion via boxes (3:52)
Another way to implement letrec in terms of let is to use set! or set-box!. We can use that idea even if we don’t otherwise provide imperative constructs in Curly. See letrec.rkt.
Letrec 6 — use before initialization (3:12)
Fixing the use of a dummy initial value by distingusihing bindings that are uninitialized from those that are initialized. See letrec-ubi.rkt.
Letrec 7 — cyclic data (5:23)
Beyond letrec: Plait support some forms of cyclic data other than functions through a shared form.