next up previous
Contents Next: cdr (Function) Up: Appendix: Selected Lisp Previous: car (FUNCTION)

caar, cadr, cdar, cddr, etc. (FUNCTIONS)

Format: (c-r <list> )

Required arguments: 1

Argument must evaluate to a list (or cons pair).

The function cxyr is a composition of the function cxr with cyr. So, for example, (cadr foo) is equivalent to (car (cdr foo)), etc. Full implementation of the ANSI Common Lisp specification provides for up to 4 letters, a or d, to appear between the c and the r.

Examples:

> (setf ds9 '(Sisko Kira Dax Odo Bashir OBrien))
(SISKO KIRA DAX ODO BASHIR OBRIEN)

> (cadr ds9)
KIRA

> (cddr ds9)
(DAX ODO BASHIR OBRIEN)

> (cddar ds9)

Error: SISKO is not of type LIST.



© Colin Allen & Maneesh Dhagat
March 2007