![]() | ![]() | ![]() | decf/delete-acons | ![]() |
|
| item
decrement place
&key key test test-not
=> new-place-value | [Macro] |
Purpose
Decrement by decrement the value associated with
item in an association list stored in place, deleting
the cons associated with item if the value becomes zero.
Package :gbbopen-tools
Module :gbbopen-tools
Arguments and values
| item | An object | |
| decrement | A number | |
| place | A form which is suitable for use as a generalized reference | |
| key | A function of one argument, or nil (default is nil)
| |
| test | A function of two arguments that returns a
generalized boolean (default is #'eql)
| |
| test-not | A function of two arguments that returns a
generalized boolean (use of :test-not is deprecated)
| |
| new-place-value | An association list |
Returns
An association list (the new value of place).
Errors
Item item is not present in the association list
stored in place.
Description
This is the inverse of pushnew/incf-acons.
See also
pushnew/incf-acons
Examples
> (setf alist '((x . 2)(y . 2)) ((x . 2)(y . 2)) > (decf/delete-acons 'x 1 alist) ((x . 1)(y . 2)) > (decf/delete-acons 'x 1 alist) ((y . 2)) > (decf/delete-acons 'y 2 alist) nil >
Note
Declared numeric and pseudo
probability versions of decf/delete-acons are also
provided: decf&/delete-acons, decf$&/delete-acons,
decf$/delete-acons, decf$$/delete-acons,
decf$$$/delete-acons, and decf%/delete-acons,
The GBBopen Project
![]() | ![]() | ![]() | decf/delete-acons | ![]() |