CAR
(first element) of the list is the name of the function to be called,
and CDR (rest of the elements) is a list of S-expressions
to be evaluated before being passed to the function (except in a few
special cases, such as QUOTE and DE).
For example, if A1 is the name of an atom and
L1 is the name of a list, then
(CONS A1 (CDR L1))
returns as value a new list which is like L1 except that
its first element has been replaced by A1.
You cannot use parentheses as freely in LISP as in other programming
languages; every parenthesis has a meaning. In particular, an atom
immediately following an open parenthesis is treated as the name of a
function. To test if two atoms are equal in value you may write
(EQ A1 A2), but if you accidentally write (EQ (A1
A2)), this says to call the function A1 with the
parameter A2 (a bad start), then use the result as the
single parameter to EQ (a bad ending).
LISP is case-sensitive; many (but not all) LISP systems
require that predefined names such as CONS be
capitalized.
You may use whitespace (blanks, tabs, and newlines) to format LISP programs however you please.
![]() |
![]() |
![]() |