Building Lists Incrementally

Often one wants to build up a list incrementally; this is usually done using cons.

Note that for any x, (cons x '()) = (list x ) :

(cons 'a '())    =  (a)

(cons '(a) '()) = ((a))

If lst is a list, then (cons x lst ) will make a new list with x as its first element, followed by the other elements of lst.

(cons 'a '(b c))    =  (a b c)

(cons '(a) '(b c)) = ((a) b c)

Contents    Page-10    Prev    Next    Page+10    Index