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:
> Roland Winkler <winkler <at> gnu.org> writes:
>
>> Actually, I just read the docstring from alist-get a couple of times.
>> And the meaning of the optional arg REMOVE is not clear to me: what is
>> the "new value" of an association if the key is removed from the
>> alist?
>
> "new value" refers to the second argument of your `setf' call. The
> association is removed if you set the associated value to the default
> value (nil most of the time) and if REMOVE had been specified.
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?
If there happen to be deep reasons for this, I can't help thinking that
they are not becoming clear from the documentation.
-- I thought about also adding a similar functionality to add-to-alist.
But I could not think of a way that meaningfully aligns with what is
accomplished with the other args of add-to-alist. Removing an
association from an alist is a different story than adding / modifying
an association. For user init files, I would suggest a different
function that will do only that and nothing else, instead of adding more
arguments to add-to-alist.
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.