Playlist | schedule page slides as PDF |
Letrec 1 — encoding redux (1:06)
Our encoding of letrec works for functions, but it’s not as general as letrec in Shplait.
Letrec 2 — letrec (3:00)
A closer look at letrec and how it might be implemented in terms of Shplait’s letrec.
Letrec 3 — metacircular interp (2:01)
Filling in interp and trying it out. See letrec_mc.rhm. 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 (2:38)
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:09)
Another way to implement letrec in terms of let is to use := or set_box. We can use that idea even if we don’t otherwise provide imperative constructs in Moe. See letrec.rhm.
Letrec 6 — use before initialization (1:58)
Fixing the use of a dummy initial value by distingusihing bindings that are uninitialized from those that are initialized. See letrec_ubi.rhm.