replace slice of list to a element
Posted: Wed Jun 11, 2014 2:33 pm
As manual said:
If I want replace a piece of list to a element:
I use:
If have any other simple way to get result?
.Slices or rest parts of lists or arrays as used in implicit resting or slicing cannot be substituted at once using setf, but would have to be substituted element by element.
If I want replace a piece of list to a element:
Code: Select all
(set 'lst '(a b c d e f)
(replace-slice (slice lst 2 3) 'g)
lst --> '(a b g f)
Code: Select all
(append (nth '(0 1) lst) 'g (nth 5 lst))