- Whereas
**car**and**cdr**take lists apart, the**cons**function constructs a new list from an expression and another list:

(**cons**'a '(b c)) => (a b c) - The fundamental decision making construct in LISP is the
cond function, also known as "McCarthy Conditional". The form is:
(

**cond**

(<condition> <expression>)

(<condition> <expression>)

(<condition> <expression>)

(...)

)where each <condition> is tested in sequence, and the first that is true selects the <expression> that is the result of the

**cond**function. - <condition>s in LISP can be any truth-value (t or nil) producing
expression including comparisons such as:
(> 'a 'b)

(= 'a 'b)or special functions such as

null?

list?

atom?In some versions of LISP (including ours) the ? may be omitted.

The null atom is the non-existant element of an empty list;
thus there is a significant difference between the empty list () and the null
atom. Thus

(**Note:** the above comment is somewhat confusing.
With our LISP interpreter, there doesn't seem to be the significant
difference mentioned above. For example, `(= '() (car '()))` returns
`t`.)

The list of implemented functions in our version of the LISP interpreter is here.

CS1104
Main Page

Last Updated 01/05/2000

©
L.Heath, 2000