Next: , Up: Symbols   [Index]


1.5.1 Special Functions

LISP treats ‘setq’ differently from other functions because ‘setq’ is an instance of a special function. Whereas LISP causes the arguments to an ordinary function to be evaluated, LISP may handle the arguments of each special function rather idiosyncratically. There are only a small number of special functions in LISP.

Note that when we assigned ‘x’ a value using ‘setq’, LISP also printed out that value. That is, the expression ‘(setq x 5)’ returned the value ‘5in addition to assigning ‘x’ the value ‘5. This is important in that we can use the value returned by ‘setq’ to continue the computation. Consider the following:

-> (+ 2 (setq x (* 3 4)))
14
-> x
12

Apply the rule of LISP evaluation: