The 'caaar', 'caadr', 'cadar' and 'caddr' functions go through the list
expression and perform a sequence of
error: bad argument
(setq mylist '(((11A 11B) (12A 12B) (13A 13B)) ; make a 3-level list ((21A 21B) (22A 22B) (23A 23B)) ((31A 31B) (32A 32B) (33A 33B)) ((41A 41B) (42A 42B) (43A 43B)))) (caaar mylist) ; returns 11A (caadr mylist) ; returns (21A 21B) (cadar mylist) ; returns (12A 12B) (caddr mylist) ; returns ((31A 31B) (32A 32B) (33A 33B)) (cdaar mylist) ; returns (11B) (cdadr mylist) ; returns ((22A 22B) (23A 23B)) (cddar mylist) ; returns ((13A 13B)) (cdddr mylist) ; returns (((41A 41B) (42A 42B) (43A 43B)))
Note: The 'cx...xr' functions are part of the historical Lisp
functions. In XLISP you probably will find it much more convenient to work
with the modern lisp functions like
nth and
nthcdr. Please read the
list functions page in the
See the
cxxxr
functions in the