Next: , Previous: , Up: Lists in Elisp   [Index]


D.2.4.2 Association Lists

An association list or alist is a specially-constructed list whose elements are cons cells. In each element, the CAR is considered a “key”, and the CDR is considered an “associated value”. Association lists are often used as stacks, since it is easy to add or remove associations at the front of the list.

(setq alist-of-colors
      '((rose . red) (lily . white) (buttercup . yellow)))

Above, alist-of-colors is an alist of three elements. In each element, the first object is the key, and the second is the value.