cons:
| car | cdr |
Lists are a basic data structure in Lisp; in fact, Lisp code is made of lists. The external (printed) representation of lists is a sequence of elements enclosed in parentheses.
(first '(a b c)) = A (rest '(a b c)) = (B C) (second '(a b c)) = B (cons 'new '(a b c)) = (NEW A B C) (list 'a 'b 'c) = (A B C)first is also called car; rest is also called cdr.
The quote symbol ' is a shorthand for the pseudo-function quote. (quote x) = x, that is, quote returns the symbol itself rather than the value of the symbol.
Contents    Page-10    Prev    Next    Page+10    Index