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. Up to 3 letters, a or d, may 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)

>(cdddr ds9)

Error: SISKO is not of type LIST.



© Colin Allen & Maneesh Dhagat
November 1999