Execution of Functions
When Lisp encounters a function call, it does the following:
- Each argument specified in the
call to the function is evaluated to
produce a single value, the actual
- A new stack frame or environment
is created to hold bindings for the execution of the function.
- Each formal argument (symbol specified as an
argument in the definition of the function) is bound
to the corresponding actual argument,
and this binding is added to the current stack frame.
- The code of the function is executed; this produces a
value, which is returned as the value of the function.
- The stack frame is removed (``popped off'').
The variables that were bound inside the function revert to
their previous values (or become unbound) when the function exits.