From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matt Price Newsgroups: gmane.emacs.help Subject: Re: adding a string to every element in a list Date: Tue, 18 Nov 2008 13:03:12 -0500 Organization: History Department, University of Toronto Message-ID: <1227031392.31451.2499.camel@localhost> References: <1226901075.25203.2782.camel@localhost> <492109F3.6040002@gatech.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1227031543 25893 80.91.229.12 (18 Nov 2008 18:05:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Nov 2008 18:05:43 +0000 (UTC) Cc: emacs To: Matthew Flaschen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 18 19:06:43 2008 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 1L2Uwq-00047v-Uq for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Nov 2008 19:05:38 +0100 Original-Received: from localhost ([127.0.0.1]:54343 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2Uvh-0004OT-52 for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Nov 2008 13:04:01 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L2UvO-0004OI-L3 for help-gnu-emacs@gnu.org; Tue, 18 Nov 2008 13:03:42 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L2UvM-0004Ns-8i for help-gnu-emacs@gnu.org; Tue, 18 Nov 2008 13:03:42 -0500 Original-Received: from [199.232.76.173] (port=35244 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2UvM-0004Np-2K for help-gnu-emacs@gnu.org; Tue, 18 Nov 2008 13:03:40 -0500 Original-Received: from bureau60.ns.utoronto.ca ([128.100.132.147]:52252) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L2UvL-0000VQ-Gx for help-gnu-emacs@gnu.org; Tue, 18 Nov 2008 13:03:39 -0500 Original-Received: from anarres.mercey.org (CPE001d7e1d5798-CM0014f8cd1c4c.cpe.net.cable.rogers.com [173.32.83.31]) (authenticated bits=0) by bureau60.ns.utoronto.ca (8.13.8/8.13.8) with ESMTP id mAII3OAw001071 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 18 Nov 2008 13:03:32 -0500 Original-Received: by anarres.mercey.org (Postfix, from userid 1000) id 363671202A8; Tue, 18 Nov 2008 13:03:14 -0500 (EST) In-Reply-To: <492109F3.6040002@gatech.edu> X-Mailer: Evolution 2.24.1 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:59906 Archived-At: thanks matt, i don't know why this didn't occur to me -- i was hung up on modifying the original list, i guess, not thinking i could just create a new one. anyway thanks to you and to drew, who also replied. matt On Mon, 2008-11-17 at 01:06 -0500, Matthew Flaschen wrote: > Matt Price wrote: > > i have no doubt this is trivial in lisp, but my documentation searches always take > > me back to cons, car, and cdr, which don't seem like the easiest tools > > for this task, though maybe it's just that i don't really understan > > recursion... > > Just use mapcar, and it will handle the recursion: > > (setq list (list "dog" "cat" "fish")); > (mapcar (lambda (arg) (concat arg "food")) list) > > Matt Flaschen -- Matt Price matt.price@utoronto.ca