<aside> 💡 Local definitions (written in the format (local [<defintions>] <expressions>)) should be used whenever…

  1. multiple functions need to be encapsulated into a new function
  2. a recursive function needs to compute the same thing more than once.

Forming local definitions is a 3-step process —

  1. renaming local objects wherever they are referenced in the local expression
  2. lifting local object definitions into the global scope
  3. replacing the local function by its body (i.e. its trampoline functions)

Locally-defined objects have a restricted scope and are typically inaccessible to objects in the global scope.

</aside>


Forming and Intuition

Screenshot 2022-05-18 at 9.29.48 PM.png


Lexical Scoping

<aside> 🔍 Another discussion of lexical scoping through University of Washington’s Programming Languages course can be found here.

</aside>