From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: Creating a list Date: Thu, 19 Nov 2009 09:35:25 +0100 Organization: Organization?!? Message-ID: <87y6m2kj3m.fsf@lola.goethe.zz> References: <87k4xnge1t.fsf@Traian.DecebalComp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1258620059 29650 80.91.229.12 (19 Nov 2009 08:40:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Nov 2009 08:40:59 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 19 09:40:52 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 1NB2ZP-0003cf-Ln for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Nov 2009 09:40:51 +0100 Original-Received: from localhost ([127.0.0.1]:55464 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NB2ZP-0004uD-49 for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Nov 2009 03:40:51 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!goblin1!goblin.stu.neva.ru!news.osn.de!diablo2.news.osn.de!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) Cancel-Lock: sha1:EddJS8snk+NkRKwcufNYu0kOkb4= Original-Lines: 36 Original-NNTP-Posting-Date: 19 Nov 2009 09:35:27 CET Original-NNTP-Posting-Host: 55beef56.newsspool2.arcor-online.net Original-X-Trace: DXC=J06fnZfmZ8dg`45cDR8l?oA9EHlD; 3Ycb4Fo<]lROoRa8kF5MOK`K\ddD?^LUc Original-X-Complaints-To: usenet-abuse@arcor.de Original-Xref: news.stanford.edu gnu.emacs.help:174831 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:69905 Archived-At: Cecil Westerhof writes: > At the moment I create a list with: > (setq ret-val (cons total-amount (cons current-amount ()))) > I thought about doing it with: > (setq ret-val (cons total-amount '(current-amount))) > > But then the second value is the string current-amount Wrong. The _symbol_ current-amount. > instead of the value of current-amount. Is there a better way to build > the list? At this moment it is not a problem, but when I want to build > a list from 30 values ... I would really recommend taking a look at the Introduction to Elisp Programming (info "(eintr)") Press C-x C-e here --^ This is sort of obvious: (setq ret-val (list total-amount current-amount)) If you have a large piece of structure around the variable values and would prefer to write it in its unevaluated form, you can also use (setq ret-val `(,total-amount ,current-amount)) namely backquote the entire structure, and put a comma before everything within the structure that is to evaluated instead of quoted. After byte-compilation, the resulting code is rather the same. -- David Kastrup