[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: replace element in list
From: |
Stefan Monnier |
Subject: |
Re: replace element in list |
Date: |
Thu, 22 Nov 2018 08:19:49 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> I want to share and know if there is a better way (more efficient or
> clearer) to replace something within a list (I don't know LISP).
My suggestion is to not do it:
- if you do it by modifying the list in place, it means you're using
nasty side-effects, which are better avoided when possible
(especially with lists).
- if you want to do it without side-effects, your operation will
inevitably be algorithmically inefficient because a list is not
designed for that.
-- Stefan