From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Navy Cheng Newsgroups: gmane.emacs.help Subject: Re: How to use a symbol and its value to create alist? Date: Wed, 12 Aug 2015 09:35:48 +0800 Message-ID: <20150812013548.GA22098@debian> References: Reply-To: Navy Cheng NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1439343390 28352 80.91.229.3 (12 Aug 2015 01:36:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Aug 2015 01:36:30 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 12 03:36:21 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZPKxo-000150-JB for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Aug 2015 03:36:20 +0200 Original-Received: from localhost ([::1]:36329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPKxn-0000p2-VR for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Aug 2015 21:36:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPKxd-0000ot-Uz for help-gnu-emacs@gnu.org; Tue, 11 Aug 2015 21:36:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPKxW-0006ZR-Fq for help-gnu-emacs@gnu.org; Tue, 11 Aug 2015 21:36:09 -0400 Original-Received: from m15-112.126.com ([220.181.15.112]:34139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPKxV-0006Yi-Kz for help-gnu-emacs@gnu.org; Tue, 11 Aug 2015 21:36:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=Date:From:Subject:Message-ID:MIME-Version; bh=svIio jIKIKJbNHRpHpV9EoyNvfKH6n0Mv1s/myb00iY=; b=MdM2yRxOYKIUJdQIcvU3X CDAAla64JhME5nPP+apVsKef98dv3B+tTNtQyIdAijApGh0C2vy8yli3QTAGr4ng mP13ngcMENbapNtcOzgElgnnNxe4DRF9NW+AfXVKvN1it69l9J80LBqv9fFBoQJ7 abnKM6C5rLO41cW9NHooYE= Original-Received: from localhost (unknown [140.207.196.4]) by smtp2 (Coremail) with SMTP id DMmowEBJbEL2ospVVw0cAA--.11050S3; Wed, 12 Aug 2015 09:35:50 +0800 (CST) Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-CM-TRANSID: DMmowEBJbEL2ospVVw0cAA--.11050S3 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUx66wDUUUU X-Originating-IP: [140.207.196.4] X-CM-SenderInfo: 5qdy5ubk6rjloofrz/1tbi0BZUDVUJSu3ZQAAAs9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 220.181.15.112 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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 Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106482 Archived-At: On Tue, Aug 11, 2015 at 07:21:15PM -0500, Barry Margolin wrote: > In article , > Navy Cheng wrote: > > > For example: > > > > (setq a 1) > > (setq b 2) > > (setq c 3) > > > > How can I a alist, like: > > ((a . 1) (b . 2) (c .3)) > > > > The value of a, b and c may change, so don't do this like > > (setq tree ((a . 1) (b . 2) (c .3))) > > > > Thank you! > > I suspect this is what you want: > > (setq tree (list (cons 'a a) (cons 'b b) (cons 'c c))) > > or using backquote: > > (setq tree `((a . ,a) (b . ,b) (c . ,c))) > Thank you for your help, This is what I want.