- (c-assoc KEY ALIST) → pair or '#fsyntax
- (c-assoc KEY ALIST '(OP ...)) → pair or '#fsyntax
ATTENTION: When using the default comparison operator, this CK-macro has major pitfalls that you should be aware of. If you do not require strict R5RS portability, it is recommended to use the comparison operator '(c-equal?) instead.
Searches ALIST for the first pair whose car matches KEY, then yields that pair. Yields '#f if no match is found. ALIST must be an association list, i.e. a list of pairs.
Uses '(OP ...) for comparison, or '(c-sym-equal?) if '(OP ...) is omitted.
Analogous to assoc from SRFI 1.
(ck () (c-quote (c-assoc 'x '((a . 1) (b . 2) (a . 3))))) ;; ==> '#f (ck () (c-quote (c-assoc 'a '((a . 1) (b . 2) (a . 3))))) ;; ==> '(a . 1) (ck () (c-quote (c-assoc '(a) '((a . 1) (b . 2) ((a) . 3))))) ;; ==> '((a) . 3)