An association list is a collection of list pairs of the form:
((key1 item1) (key2 item2) ... (keyN itemN))
The 'assoc' function searches through an association list
'
(setq mylist '((a . my-a)
               (b . his-b)
               (c . her-c)
               (d . end)))
(assoc 'a mylist)  => (A . MY-A)
(assoc 'b mylist)  => (B . HIS-B)
(assoc  1 mylist)  => NIL
(setq agelist '((1 (bill bob))
                (2 (jane jill))
                (3 (tim tom))
                (5 (larry daryl daryl))))
(assoc 1 agelist)                 => (1 (BILL BOB))
(assoc 3 agelist :test #'>=)      => (1 (BILL BOB))
(assoc 3 agelist :test #'<)       => (5 (LARRY DARYL DARYL))
(assoc 3 agelist :test #'<=)      => (3 (TIM TOM))
(assoc 3 agelist :test-not #'>=)  => (5 (LARRY DARYL DARYL))
Using a list as key, tested with equal:
> (assoc '(a b) '(((c d) e) ((a b) x)) :test #'equal) ((A B) X)
Note: The 'assoc' function can work with a list or string as the
'expr'. However, the default eql test does
not work with lists or strings, only symbols and numbers.
See also: