help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adding a string to every element in a list


From: Matt Price
Subject: Re: adding a string to every element in a list
Date: Tue, 18 Nov 2008 13:03:12 -0500

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]