An object.
An association list.
A function designator.
A function designator.
A function designator.
An object.
The functions
cdr-assoc
and
(setf cdr-assoc)
provide a generalized reference for elements in an association list. The arguments are all as specified for the Common Lisp function
assoc
.
cdr-assoc
and
(setf cdr-assoc)
read and write the
cdr
of an element in a manner consistent with the Common Lisp notion of places.
cdr-assoc
returns the
cdr
of the first cons in the alist
alist
that satisfies the test, or
nil
if no element of
alist
matches.
(setf cdr-assoc)
modifies the first cons in
alist
that satisfies the test, setting its
cdr
to
value
. If no element of
alist
matches, then
(setf cdr-assoc)
constructs a new cons
(cons
item
value
)
and inserts it in the head of
alist
.
CL-USER 1 > (defvar *my-alist*
(list (cons :foo 1)
(cons :bar 2)))
*MY-ALIST*
CL-USER 2 > (setf (sys:cdr-assoc :bar
*my-alist*) 3)
3
CL-USER 3 > *my-alist*
((:FOO . 1) (:BAR . 3))