assoc, assq, assv
assv(g_keyl_alist) =>l_association/nil
Description
The assoc, assq, and assv functions find the first list in l_alist whose car field is g_key and return that list. assq uses eq to compare g_key with the car fields of the lists in alist. assoc uses equal. assv uses eqv.
The association list, l_alist, must be a list of lists. An association list is a standard data structure that has the form ((key1 value1) (key2 value2) (key3 value3) ...). These functions find the first list in l_alist whose car field is g_key and return that list. assq uses eq to compare g_key with the car fields of the lists in l_alist. assv uses eqv. assoc uses equal.
Arguments
Value Returned
Examples
e = '((a 1) (b 2) (c 3))
(assq 'a e)
=> (a 1)
(assq 'b e)
=> (b 2)
(assq 'd e)
=> nil
(assq (list 'a) '(((a)) ((b)) ((c))))
=> nil
(assoc (list 'a) '(((a)) ((b)) ((c))))
=> ((a))
(assv 5 '((2 3) (5 7) (11 13)))
=> (5 7)
Related Topics
Return to top