eintr: Complications
Complications
-------------
Now, for the first complication. In addition to lists, the Lisp
interpreter can evaluate a symbol that is not quoted and does not have
parentheses around it. The Lisp interpreter will attempt to determine
the symbol’s value as a “variable”. This situation is described in the
section on variables. (Variables.)
The second complication occurs because some functions are unusual and
do not work in the usual manner. Those that don’t are called “special
forms”. They are used for special jobs, like defining a function, and
there are not many of them. In the next few chapters, you will be
introduced to several of the more important special forms.
As well as special forms, there are also “macros”. A macro is a
construct defined in Lisp, which differs from a function in that it
translates a Lisp expression into another expression that is to be
evaluated in place of the original expression. (Lisp macro.)
For the purposes of this introduction, you do not need to worry too
much about whether something is a special form, macro, or ordinary
function. For example, ‘if’ is a special form (if), but ‘when’
is a macro (Lisp macro). In earlier versions of Emacs, ‘defun’
was a special form, but now it is a macro (defun). It still
behaves in the same way.
The final complication is this: if the function that the Lisp
interpreter is looking at is not a special form, and if it is part of a
list, the Lisp interpreter looks to see whether the list has a list
inside of it. If there is an inner list, the Lisp interpreter first
figures out what it should do with the inside list, and then it works on
the outside list. If there is yet another list embedded inside the
inner list, it works on that one first, and so on. It always works on
the innermost list first. The interpreter works on the innermost list
first, to evaluate the result of that list. The result may be used by
the enclosing expression.
Otherwise, the interpreter works left to right, from one expression
to the next.