alists
An alist, short for association list, is a simple data structure used to map keys to values in Lisp and related languages. It consists of a list whose elements are pairs, typically represented as cons cells with the key in the car and the value in the cdr. Alists are often used for small, static mappings and can be implemented with keys of any comparable type.
Access and modification in an alist are usually done through linear search. Common operations include looking
Complexity and trade-offs: lookup time is O(n) in the length of the alist, and updates may require
Example (Lisp-like syntax): A = ((apple . 3) (banana . 5) (orange . 2)); (assoc 'banana A) yields (banana . 5);
See also: association list, plist, hash table, dictionary, assoc.