Evaluation is the process by which Lisp determines
the value of an expression; Lisp uses the following recursive algorithm:
- If the expression to be evaluated is a constant, such as a number,
#t or #f, the value is the expression itself.
- If the expression is (QUOTE x), which we abbreviate as 'x,
the value is x.
- If the expression is a symbol, the value is the
of the symbol (or an error if the symbol is unbound).
- Otherwise, the expression must be a list that represents a
function call or special form:
Special forms such as if, quote,
define, and set! do not evaluate all their arguments.
- Evaluate each element of the function call, in left-to-right
- Call the function with the values of the arguments.
- The value is the value returned by the function.
Note that evaluation ``calls itself'' recursively to evaluate arguments.