Next: , Previous: , Up: Data   [Contents][Index]


16.4.3.3 Lisp Programs as Data—Lists

We re now in a position to appreciate one of the most remarkable features of Lisp:

Lisp programs are expressed as lists.

It means that Lisp programs can generate Lisp code. Lisp programmers write programs to write their programs for them. It is important to understand the relation between expressions and lists. This is why we need the quote. If a list is quoted, evaluation returns the list itself; if it is not quoted, the list is treated as code, and evaluation returns its value:

> (list '(+ 2 1) (+ 2 1))
((+ 2 1) 3)

Here, the first argument is quoted, and so yields a list. The second argument is not quoted, and is treated as a function call, yielding a number.