chickadee » srfi-1 » alist-delete

alist-delete key alist #!optional =procedure
alist-delete! key alist #!optional =procedure

alist-delete deletes all associations from ALIST with the given KEY, using key-comparison procedure =, which defaults to equal?. The dynamic order in which the various applications of = are made is not specified.

Return values may share common tails with the ALIST argument. The alist is not disordered -- elements that appear in the result alist occur in the same order as they occur in the argument alist.

The comparison procedure is used to compare the element keys K_I of ALIST's entries to the KEY parameter in this way: (= KEY K_I). Thus, one can reliably remove all entries of ALIST whose key is greater than five with (alist-delete 5 ALIST <)

alist-delete! is the linear-update variant of alist-delete. It is allowed, but not required, to alter cons cells from the ALIST parameter to construct the result.