11.5 Chapter Summary
In this chapter, we implemented non-recursive and recursive, user-defined functions in Camille. In Camille, functions are represented as closures. We built three representations for the closure data type: an abstract-syntax representation (ASR), a closure representation (CLS), and a Python closure representation (i.e., lambda expressions in Python; Programming Exercise 11.2.12). When a function is invoked, we pass the values to be bound to the arguments of the function to the closure representing the function. For the ASR and CLS representations of a closure, a pointer to the environment in which the function is defined is stored in the closure (i.e., lexical scoping). For the Python closure representation (i.e., lambda ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access