unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: replacing a certain element in a list with another
Date: Thu, 23 Oct 2003 09:30:42 -0600	[thread overview]
Message-ID: <mailman.2310.1066923106.21628.bug-gnu-emacs@gnu.org> (raw)
In-Reply-To: jwvoew8xcc2.fsf-monnier+gnu.emacs.help@vor.iro.umontreal.ca

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

  reply	other threads:[~2003-10-23 15:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-30  8:38 replacing a certain element in a list with another Klaus Berndl
2003-09-30  9:05 ` David Kastrup
2003-09-30  9:59   ` Klaus Berndl
2003-09-30 10:03     ` David Kastrup
2003-09-30 10:19       ` Klaus Berndl
2003-09-30 12:12     ` Pascal Bourguignon
2003-09-30 14:14       ` Stefan Monnier
2003-09-30 14:26         ` Klaus Berndl
2003-09-30 14:16 ` Stefan Monnier
2003-09-30 14:28   ` Klaus Berndl
2003-09-30 15:03     ` Stefan Monnier
2003-09-30 15:30       ` Kevin Rodgers
2003-09-30 15:47         ` Stefan Monnier
2003-09-30 18:27           ` Roland Winkler
2003-09-30 20:01             ` Barry Margolin
2003-10-16 20:52             ` Kai Grossjohann
2003-10-22 20:06               ` Roland Winkler
2003-10-22 20:32                 ` Barry Margolin
2003-10-23 12:46                   ` Roland Winkler
2003-10-23 14:25                     ` Stefan Monnier
2003-10-23 15:30                       ` Kevin Rodgers [this message]
2003-10-23 15:18                     ` Barry Margolin
2003-10-23 22:03                       ` Roland Winkler
2003-10-23 22:20                         ` Barry Margolin
2003-10-24 12:02                           ` Roland Winkler
2003-10-24 15:06                             ` Barry Margolin
2003-10-25 11:25                             ` Oliver Scholz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mailman.2310.1066923106.21628.bug-gnu-emacs@gnu.org \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).