* Re: replacing a certain element in a list with another
[not found] ` <jwvoew8xcc2.fsf-monnier+gnu.emacs.help@vor.iro.umontreal.ca>
@ 2003-10-23 15:30 ` Kevin Rodgers
0 siblings, 0 replies; only message in thread
From: Kevin Rodgers @ 2003-10-23 15:30 UTC (permalink / raw)
Stefan Monnier wrote:
>Roland Winkler wrote:
>>It might be helpful to add a comment to the docstring or info page
>>for nreverse saying that its argument is modified such that
>>afterwards it is a 1-element list containing the last element of the
>>reversed list.
>
> I don't think this particular aspect of the behavior should be documented.
> Maybe we should add a note saying "the argument should not be used
> afterwards", but even that would not be very convincing.
> I think the only reasonable thing to put is a "don't use this unless you
> know what you're doing".
Why not document all the destructive list operations like delq, whose
doc string says:
If the first member of LIST is ELT, there is no way to remove it by side
effect; therefore, write `(setq foo (delq element foo))' to be sure of
changing the value of `foo'.
For nreverse, it would be:
Because the first cons cell of LIST is the last cons cell of the
returned list, write `(setq foo (nreverse foo))' to set `foo' to its
reversed value.
--
Kevin Rodgers
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-10-23 15:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <uzngmisct.fsf@sdm.de>
[not found] ` <m3u16u5dyn.fsf@tfkp07.physik.uni-erlangen.de>
[not found] ` <86ekxcykfs.fsf@slowfox.dyndns.org>
[not found] ` <m3k76xf34y.fsf@tfkp07.physik.uni-erlangen.de>
[not found] ` <9PBlb.171$lK3.18@news.level3.com>
[not found] ` <m3u160cea8.fsf@tfkp07.physik.uni-erlangen.de>
[not found] ` <jwvoew8xcc2.fsf-monnier+gnu.emacs.help@vor.iro.umontreal.ca>
2003-10-23 15:30 ` replacing a certain element in a list with another Kevin Rodgers
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).