Learning Module 5 — Interpreters and Functions
Why this is important: This module teaches you how closures work. Understanding this not only helps you write an interpreter that can handle functions, but also helps you understand how to use closures properly in languages that support them (which is nearly all of them these days).
Outcomes
- 5.1 – Give the proper
eval
code to create a closure from a function expression. (3 points) - 5.2 – Give the proper
eval
code to implement a function (closure) call. (3 points) - 5.3 – Explain why we need to maintain a separate environment for a closure. (MC) (2 point)
- 5.4 – Explain the difference between a procedure and a function. (MC) (2 point)