Evaluation
==========
So far only the primitive data types have been discussed, and how the
Lisp reader converts textual descriptions of these types into Lisp
objects. Obviously there has to be a way of actually computing
something--it would be difficult to write a useful program otherwise.
What sets Lisp apart from other languages is that in Lisp there is no
difference between programs and data: a Lisp program is just a sequence
of Lisp objects which will be evaluated as a program when required.
The subsystem which does this evaluation is called the "Lisp
evaluator" and each expression to be evaluated is called a "form". The
evaluator (the function `eval') examines the structure of the form that
is applied to it and computes the value of that form within the current
Lisp environment.
A form can be any type of data object; the only types which the
evaluator treats specially are symbols (which describe variables) and
lists (subroutine applications), anything else is returned as-is (and
is called a "self-evaluating form").
- Function: eval form
This function computes and returns the value of FORM within the
current module and dynamic environment, and a null lexical
environment.
However, `eval' is rarely explicitly invoked, except in the
read-eval-print loop. Lisp provides many other methods of evaluation
that are usually much more suitable within a program.
- Variable: max-lisp-depth
This variable limits the number of nested calls to `eval'. If more
than this many nested calls to `eval' exist, an error is
signalled. The intention is to detect infinite recursion before
hitting the stack size limit (causing a segmentation fault).