From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Roland Winkler Newsgroups: gmane.emacs.help Subject: Re: replacing a certain element in a list with another Date: 24 Oct 2003 14:02:15 +0200 Organization: FAU Erlangen-Nuernberg Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <8jSlb.186$lK3.106@news.level3.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1066997918 13305 80.91.224.253 (24 Oct 2003 12:18:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Oct 2003 12:18:38 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 24 14:18:36 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 1AD0to-0007Q1-00 for ; Fri, 24 Oct 2003 14:18:36 +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 1AD0rX-0002Yx-KE for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Oct 2003 08:16:15 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!logbridge.uoregon.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-fra1.dfn.de!news-nue1.dfn.de!uni-erlangen.de!news.uni-erlangen.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 42 Original-NNTP-Posting-Host: tfkp07.physik.uni-erlangen.de Original-X-Trace: rznews2.rrze.uni-erlangen.de 1066996935 16828 131.188.164.207 (24 Oct 2003 12:02:15 GMT) Original-X-Complaints-To: news@uni-erlangen.de Original-NNTP-Posting-Date: 24 Oct 2003 12:02:15 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Xref: shelby.stanford.edu gnu.emacs.help:117578 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:13510 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13510 Barry Margolin writes: > The verbose documentation of all the destructive list operations should > mention that you must use the value to get the expected results all the > time, rather than depending on everything to work due to the lists being > modified in place. The first part of your sentence is exactly my point. Unlike the docstring of nreverse, the info node presently does not say explicitely that it is the _return_ value that should be used. (It is hidden only implicitely in the sentence: "To avoid confusion, we usually store the result of `nreverse' back in the same variable which held the original list.") The info node Rearrangement in the elisp manual says: - Function: nreverse list This function reverses the order of the elements of LIST. Unlike `reverse', `nreverse' alters its argument by reversing the CDRs in the cons cells forming the list. The cons cell that used to be the last one in LIST becomes the first cons cell of the value. For example: (setq x '(a b c)) => (a b c) x => (a b c) (nreverse x) => (c b a) ;; The cons cell that was first is now last. x => (a) The last two lines I find confusing because they use the argument of nreverse after it was passed to nreverse. (They gave rise to my question whether the argument of nreverse could be used for anything "useful" after it was passed to nreverse.) Instead, the info node could use the same sentence that is used in the docstring of nreverse: Returns the beginning of the reversed list.