rassoc
rassoc is a function found in Lisp dialects such as Common Lisp. It searches an association list (alist) for the first pair whose cdr matches a given key, making it the reverse of the more common assoc function, which compares the car of pairs to a key. In use, rassoc takes a key and an alist and returns the first cons cell where the cdr is considered equal to the key according to a specified test.
The typical Lisp signature is (rassoc key alist &key test test-not-found). The test argument designates the function
As a linear search through the alist, rassoc has O(n) time complexity in the length of the
Example: (rassoc 'bar '((a . foo) (b . bar))) yields (b . bar). If there is no matching pair,