From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kai Grossjohann Newsgroups: gmane.emacs.help Subject: Re: replacing a certain element in a list with another Date: Thu, 16 Oct 2003 22:52:23 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <86ekxcykfs.fsf@slowfox.dyndns.org> References: <3F79A1AA.5040008@yahoo.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1066338233 13976 80.91.224.253 (16 Oct 2003 21:03:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 16 Oct 2003 21:03:53 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 16 23:03:50 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AAFHi-0002Iv-00 for ; Thu, 16 Oct 2003 23:03:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AAFGk-0007A3-U5 for geh-help-gnu-emacs@m.gmane.org; Thu, 16 Oct 2003 17:02:50 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!p508e26bf.dip.t-dialin.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-NNTP-Posting-Host: p508e26bf.dip.t-dialin.net (80.142.38.191) Original-X-Trace: news.uni-berlin.de 1066337446 25380649 80.142.38.191 (16 [73968]) User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (berkeley-unix) Cancel-Lock: sha1:hn+Iwq1VbM8LKiQl798DlCBoldw= Original-Xref: shelby.stanford.edu gnu.emacs.help:117329 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13259 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13259 Roland Winkler 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