Constructing Lists

An important feature of Lisp is the ability to construct new symbolic structures of arbitrary size and complexity at runtime.

A new list structure with a fixed number of elements can be made using the function list. To make a list of items x_1 ... x_n, use the form:

(list x_1 ... x_n)

Each argument of list is evaluated unless it is quoted.


(list 'x 'y 'z)  =  (x y z)

(list (+ 2 3) (* 2 3)) = (5 6)

(define man 'adam) (define woman 'eve) (list man 'loves woman) = (adam loves eve)

(list (list 'a 'b) (list 'c 'd)) = ((a b) (c d))

(list) = ()

Contents    Page-10    Prev    Next    Page+10    Index