In my first lecture, I forgot to define the set of free variables for a quirk13 expression. This set is defined by induction on the structure of an expression.
For any expression E that is not a function or block expression,
the free variables of E are the union of the free variables of
the immediate subexpressions of E. Note that some expressions,
such as 13.7 and nil, don't have any
immediate subexpressions.
The free variables of
function (T1 X1, ..., Tn Xn) ->
T0 E
The free variables of
{ T1 X1 = Y1; ...; Tn Xn = Yn;
E1; ...; Em }I recommend that you implements sets of symbols or variables as an abstract data type, and that you represent sets by lists. If you write representation independent code, you can change the representation of this data type later without affecting the code for your compiler.