1 ;;ASSOC function searches supplied list for cons cell that have item as car part. Return value is the cell with key-value pair which key matched testing conditions, otherwise NIL. Default comparison operator is EQL. 2 3 ;;Associative list, or for short alist, is a list with key-value pairs in cons cells. That is ((key1 . value1) (key2 . value2) ...) 4 5 (assoc 'a '((a . 1) (b . 2) (c . 3))) => (A . 1) 6 (assoc 'x '((a . 1) (b . 2) (c . 3))) => NIL 7 (assoc 'b '((a . 1) (b . 2) (c . 3) (b . 4))) => (B . 2) 8 (assoc "b" '(("a" . 1) ("b" . 2))) => NIL 9 (assoc "b" '(("a" . 1) ("b" . 2)) :test #'equal) => ("b" . 2) 10 (assoc 7 '((6 . a) (9 . b)) :key #'1+) => (6 . A) 11 (assoc 5 nil) => NIL
Reference: http://jtra.cz/stuff/lisp/sclr/assoc.html
S.K.