Building Lists Incrementally

Often one wants to build up a list of things incrementally; this is usually done using CONS. First, note that for any x,

(CONS x NIL) = (LIST x) :

(CONS 'A NIL)    =  (A)

(CONS '(A) NIL)  =  ((A))

Second, 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