assv
Assv is a standard function in Common Lisp used to locate a key in an association list (alist) by applying the eqv predicate. An alist is a list of cons cells where each car is a key and each cdr is the corresponding value. The function returns the first cons cell whose car is eqv to the given key, or nil if no such pair exists. It is one of several related functions for alists, with assoc using a customizable test (defaulting to eql), assq using eq, and assv using eqv.
Syntax and behavior: The typical usage is (assv key alist). If a matching pair is found, the
Examples: Suppose the alist is ((a . 1) (b . 2) (c . 3)).
- (assv 'b '((a . 1) (b . 2) (c . 3))) yields (b . 2).
- (cdr (assv 'b '((a . 1) (b . 2) (c . 3)))) yields 2.
Because eqv considers certain objects as equivalent, assv is particularly suitable when keys are symbols or
Compatibility and usage: assv is defined in ANSI Common Lisp and is supported by major implementations such