all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* replacing a certain element in a list with another
@ 2003-09-30  8:38 Klaus Berndl
  2003-09-30  9:05 ` David Kastrup
  2003-09-30 14:16 ` Stefan Monnier
  0 siblings, 2 replies; 28+ messages in thread
From: Klaus Berndl @ 2003-09-30  8:38 UTC (permalink / raw)



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?

But: i do not want using any c-functions, so i would prefer a solution without
using `substitute'!

Is the solution easier if i always want to replace the last element of the
list?

I think so, because it could be:

(defvar my-list '( a b c d))

(let ((temp-l (nreverse my-list)))
  (setcar temp-l 'e)
  (nreverse temp-l))

Is this a good elisp-solution? 

Thanks for help,
Klaus
 
-- 
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

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2003-10-25 11:25 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-30  8:38 replacing a certain element in a list with another Klaus Berndl
2003-09-30  9:05 ` David Kastrup
2003-09-30  9:59   ` Klaus Berndl
2003-09-30 10:03     ` David Kastrup
2003-09-30 10:19       ` Klaus Berndl
2003-09-30 12:12     ` Pascal Bourguignon
2003-09-30 14:14       ` Stefan Monnier
2003-09-30 14:26         ` Klaus Berndl
2003-09-30 14:16 ` Stefan Monnier
2003-09-30 14:28   ` Klaus Berndl
2003-09-30 15:03     ` Stefan Monnier
2003-09-30 15:30       ` Kevin Rodgers
2003-09-30 15:47         ` Stefan Monnier
2003-09-30 18:27           ` Roland Winkler
2003-09-30 20:01             ` Barry Margolin
2003-10-16 20:52             ` Kai Grossjohann
2003-10-22 20:06               ` Roland Winkler
2003-10-22 20:32                 ` Barry Margolin
2003-10-23 12:46                   ` Roland Winkler
2003-10-23 14:25                     ` Stefan Monnier
2003-10-23 15:30                       ` Kevin Rodgers
2003-10-23 15:30                       ` Kevin Rodgers
2003-10-23 15:18                     ` Barry Margolin
2003-10-23 22:03                       ` Roland Winkler
2003-10-23 22:20                         ` Barry Margolin
2003-10-24 12:02                           ` Roland Winkler
2003-10-24 15:06                             ` Barry Margolin
2003-10-25 11:25                             ` Oliver Scholz

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.