Functions for List Manipulation
Car, Cdr, Cadr, Cdar, etc. (cont.)
- Any combination of 'a' and 'd' is allowed, but only 4 are permitted in each command
- Nesting them has the same result [i.e (car (cdr X)) = (cadr X)]
- If you are working with an associative list, or list of dotted pairs, when you are reading the dotted pair, 'cdr' acts like a 'cadr' i.e.
- In a normal list
- (setq VAR '(1 2))
- (car VAR) ? 1
- (cdr VAR) ? '(2)
- (cadr VAR) ? 2