GNU bug report logs -
#75170
add-to-alist: new function
Previous Next
Full log
View this message in rfc822 format
On Mon, Jan 20 2025, Michael Heerdegen wrote:
> 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.
Sure. - I just do not know real-world examples where this combination of
things is an efficient way to go.
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.