Combinations of CAR and CDR

Since combinations of CAR and CDR are frequently used, all combinations up to four uses of CAR and CDR are defined as functions of the form CxxxR:


(CAAR X)    = (CAR (CAR X))

(CADR X)    = (CAR (CDR X))

(CADDR X)   = (CAR (CDR (CDR X)))

It's worth memorizing common combinations:
CAR or FIRST = First element of a list

CADR

or SECOND = Second element

CADDR

or THIRD = Third element

CADDDR

or FOURTH = Fourth element

Functions FIRST through TENTH are defined in Common Lisp.

Contents    Page-10    Prev    Next    Page+10    Index