List Structure
cons:
first | rest |
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 'z '(a b c)) = (Z 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 argument itself rather than evaluating the argument.