GNU Info

Info Node: (emacs-lisp-intro.info)car cdr & cons

(emacs-lisp-intro.info)car cdr & cons


Next: Cutting & Storing Text Prev: Narrowing & Widening Up: Top
Enter node , (file) or (file)node

`car', `cdr', `cons': Fundamental Functions
*******************************************

   In Lisp, `car', `cdr', and `cons' are fundamental functions.  The
`cons' function is used to construct lists, and the `car' and `cdr'
functions are used to take them apart.

   In the walk through of the `copy-region-as-kill' function, we will
see `cons' as well as two variants on `cdr', namely, `setcdr' and
`nthcdr'.  (Note: copy-region-as-kill.)

Strange Names
An historical aside: why the strange names?
car & cdr
Functions for extracting part of a list.
cons
Constructing a list.
nthcdr
Calling `cdr' repeatedly.
nth
setcar
Changing the first element of a list.
setcdr
Changing the rest of a list.
cons Exercise

automatically generated by info2www version 1.2.2.9