cdaaar cdaadr ... cdddar cddddr
type: function (subr) location: built-in source file: xllist.c Common LISP compatible: yes supported on: all machines
(cdaaar <expr> ) (cdaadr <expr> ) ... (cdddar <expr> ) (cddddr <expr> ) <expr> - a list or list expression
The CDAAAR, CDAADR .... CDDDAR, CDDDDR functions go through the list expression and perform a sequence of CAR/CDR operations. The sequence of operations is performed from right to left. So CDDAAR does a CAR on the expression, followed by a CAR, followed by a CDR, followed by another CDR. If at any point the list is NIL, NIL is returned. If at anypoint a CAR operation is performed on an atom (as opposed to a list) an error is reported - "error: BAD ARGUMENT".
(setq mylist '( ( (a b) (c d) (e f) ) ; make a 3-level list ( (g h) (i j) (k l) ) ( (m n) (o p) (q r) ) ( (s t) (u v) (w x) ) ) ) (cdadar mylist) ; returns (D) (cdaddr mylist) ; returns ((O P) (Q R)) (caaadr mylist) ; returns G (cadadr mylist) ; returns (I J) (caadar mylist) ; returns C (cadddr mylist) ; returns ((S T) (U V) (W X))