chickadee » ck-macros » c-alist-delete

(c-alist-delete KEY ALIST) → listsyntax
(c-alist-delete KEY ALIST '(OP ...)) → listsyntax

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.

Removes all pairs in ALIST whose car matches KEY. 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 alist-delete from SRFI 1. Based on c-delete-assoc from the original implementation.

(ck () (c-quote (c-alist-delete 'a '((a . 1) (b . 2) (a . 3) (c . 4)))))
;; ==> '((b . 2) (c . 4)
(ck () (c-quote (c-alist-delete '(a) '((a . 1) (b . 2) ((a) . 3)))))
;; ==> '((a . 1) (b . 2))