chickadee » ck-macros » c-alist-delete

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

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))