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).
This function computes and returns the value of form within the current module and dynamic environment, and a null lexical environment.
If the optional argument structure is non-nil, then form is evaluated in that structure.
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.
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).
|• Symbol Forms:||How variables are accessed|
|• List Forms:||Subroutine calls|
|• Self-Evaluating Forms:||Forms which don’t get evaluated|
|• Quoting:||How to prevent evaluation of forms|