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

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

Re: replacing a certain element in a list with another


From: Klaus Berndl
Subject: Re: replacing a certain element in a list with another
Date: 30 Sep 2003 16:28:16 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

On Tue, 30 Sep 2003, Stefan Monnier wrote:



> > Suppose i have the following list: '(a b c d) What is a good way to
> > replace one of the list-elements with another, so foe example replacing
> > the 'c with 'e?
>  
>      (mapcar (lambda (x) (if (eq x 'c) 'e x)) <list>)
>  
>  I'd advise against using `setcar/setcdr' unless you have good reasons to
>  do it.

Why? I believe, but just for my interest and to become a better
elisp-programmer?!

Thanks,
Klaus

>  
>  
>          Stefan

-- 
Klaus Berndl                    mailto: klaus.berndl@sdm.de
sd&m AG                         http://www.sdm.de
software design & management    
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220


reply via email to

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