Skip to main content
edited tags
Link
Drew
  • 79.1k
  • 10
  • 123
  • 257
Became Hot Network Question
Source Link
ideasman42
  • 9.2k
  • 1
  • 35
  • 123

How to replace an element of a list?

Is there a way to replace an item in a list?

(replace-element-in-list (elem-src elem-dst ls &optional times comparison-fn)) 
 ;; ...
 )

Example use: (replace-element-in-list 1 100 '(3 2 1)) => '(3 2 100)