A cons is a compound data object having two components called the car and the cdr.
Depending on context, a group of connected conses can be viewed in a variety of different ways. A variety of operations is provided to support each of these various views.
Figure 14–2. Some defined names relating to trees.
A proper list is a list terminated by the empty list. The empty list is a proper list, but is not a cons.
An improper list is a list that is not a proper list; that is, it is a circular list or a dotted list.
A dotted list is a list that has a terminating atom that is not the empty list. A non-nil atom by itself is not considered to be a list of any kind—not even a dotted list.
A circular list is a chain of conses that has no termination because some cons in the chain is the cdr of a later cons.
Figure 14–3. Some defined names relating to lists.
acons | assoc-if | pairlis | rassoc-if |
assoc | assoc-if-not | rassoc | rassoc-if-not |
Figure 14–4. Some defined names related to assocation lists.
adjoin | nset-difference | set-difference | union |
intersection | nset-exclusive-or | set-exclusive-or | |
nintersection | nunion | subsetp |
Figure 14–5. Some defined names related to sets.
type-error if the value received is a dotted list.
Sandra complained that this was only said a few places, and needed to be said more. This is a stopgap while we make sure we mean it everywhere.Except as explicitly specified otherwise, for any standardized function that takes a parameter that is required to be a list, the consequences are undefined if that list is circular.
list System Classnull System Classcons System Classatom Typecons Functionconsp Functionatom Functionrplaca, rplacd Functioncar, cdr, caar, cadr, cdar, cddr, caaar, caadr, cadar, caddr, cdaar, cdadr, cddar, cdddr, caaaar, caaadr, caadar, caaddr, cadaar, cadadr, caddar, cadddr, cdaaar, cdaadr, cdadar, cdaddr, cddaar, cddadr, cdddar, cddddr Accessorcopy-tree Functionsublis, nsublis Functionsubst, subst-if, subst-if-not, nsubst, nsubst-if, nsubst-if-not Functiontree-equal Functioncopy-list Functionlist, list* Functionlist-length Functionlistp Functionmake-list Functionpush Macropop Macrofirst, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth Accessornth Accessorendp Functionnull Functionnconc Functionappend Functionrevappend, nreconc Functionbutlast, nbutlast Functionlast Functionldiff, tailp Functionnthcdr Functionrest Accessormember, member-if, member-if-not Functionmapc, mapcar, mapcan, mapl, maplist, mapcon Functionacons Functionassoc, assoc-if, assoc-if-not Functioncopy-alist Functionpairlis Functionrassoc, rassoc-if, rassoc-if-not Functionget-properties Functiongetf Accessorremf Macrointersection, nintersection Functionadjoin Functionpushnew Macroset-difference, nset-difference Functionset-exclusive-or, nset-exclusive-or Functionsubsetp Functionunion, nunion Function