From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: Remove last element in a list Date: Tue, 17 Nov 2009 16:26:04 -0500 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1258494115 6749 80.91.229.12 (17 Nov 2009 21:41:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Nov 2009 21:41:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 17 22:41:48 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NAVo4-0004Zd-0f for geh-help-gnu-emacs@m.gmane.org; Tue, 17 Nov 2009 22:41:48 +0100 Original-Received: from localhost ([127.0.0.1]:49492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAVo3-0001oF-Ee for geh-help-gnu-emacs@m.gmane.org; Tue, 17 Nov 2009 16:41:47 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!goblin1!goblin2!goblin.stu.neva.ru!feeder.erje.net!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!barmar.motzarella.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-X-Trace: news.eternal-september.org U2FsdGVkX1/jrgGcMXIXHFjp8C+xEA4SCSJQxbNKO6J0h4rEEPlzl0JpJCttrUTJ9cxo8pwxGjU+NY/o0/Cb9EiSAx1kjcOMV8O5NF+PFFUS7URrqCHaxX3sr+jr51SaUrCx8HUdDS0= Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Tue, 17 Nov 2009 21:26:04 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) X-Auth-Sender: U2FsdGVkX18fds+FT/4v/3c3gUGdW2oDpeqZX5NANFI= Cancel-Lock: sha1:TfAVzvpxelOFruNBvtFdwlJHRmY= Original-Xref: news.stanford.edu gnu.emacs.help:174780 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:69853 Archived-At: In article , LanX wrote: > ----------- M-x ielm > ELISP> list > (a b c d e f g h i) > > ELISP> (nbutlast list 1) > (a b c d e f g h) > > ELISP> list > (a b c d e f g h) > ------------- > > see "5.3 Accessing Elements of Lists" in Elisp-Info > > HTH > LanX ELISP> list (a) ELISP> (nbutlast list 1) nil ELISP> list (a) Moral: always assign the result back to the variable, even when using destructive operations, e.g. ELISP> (setq list (nbutlist list 1)) nil ELISP> list nil -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***