GNU bug report logs -
#75170
add-to-alist: new function
Previous Next
Full log
Message #82 received at 75170 <at> debbugs.gnu.org (full text, mbox):
Roland Winkler <winkler <at> gnu.org> writes:
> Why is it not enough to specify the key of the association that is
> supposed to be removed from an alist? What is the purpose of making the
> removal of an association also dependent on the values of DEFAULT and the
> 2nd arg for setf?
Please do not limit your considerations to this special case. DEFAULT
and the second arg of setf are different things. The expression you
setf to is not necessarily a constant:
(setf (alist-get ...) (get-the-element)).
About your second question: Please also think about the general case.
The promise of (setf PLACE VAL) is that VAL will be stored in PLACE
after the operation. The REMOVE arg just means: it is allowed to
achieve that by removing an association when appropriate.
(alist-get ... DEFAULT ...) will return DEFAULT
when an element is not present. If we setf to a different value we
can't remove anything from the alist because our promise would not hold
and it would not be appropriate.
Michael.
This bug report was last modified 142 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.