From: Kai Grossjohann <kai.grossjohann@gmx.net>
Subject: Re: replacing a certain element in a list with another
Date: Thu, 16 Oct 2003 22:52:23 +0200 [thread overview]
Message-ID: <86ekxcykfs.fsf@slowfox.dyndns.org> (raw)
In-Reply-To: m3u16u5dyn.fsf@tfkp07.physik.uni-erlangen.de
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:
> The function `reverse' does not alter the original argument LIST. On
> the other hand, `nreverse' reverses LIST by modifying cdr pointers.
> Why does the docstring of `reverse' say
>
> See also the function `nreverse', which is used more often.
>
> Yet, the info page for `nreverse' says
>
> To avoid confusion, we usually store the result of `nreverse' back
> in the same variable which held the original list:
>
> Wouldn't it then be more natural to use `reverse' from the
> beginning? Or am I missing something here??
Well, (nreverse x) does destructively modify the list x, but
afterwards the value if x is not what you think:
*** Welcome to IELM *** Type (describe-mode) for help.
ELISP> (setq x (list 1 2 3 4))
(1 2 3 4)
ELISP> (nreverse x)
(4 3 2 1)
ELISP> x
(1)
ELISP>
Clear?
Kai
next prev parent reply other threads:[~2003-10-16 20:52 UTC|newest]
Thread overview: 28+ 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 [this message]
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
2003-10-23 15:30 ` Kevin Rodgers
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86ekxcykfs.fsf@slowfox.dyndns.org \
--to=kai.grossjohann@gmx.net \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.