lisp123456

Untitled

Dec 2nd, 2021
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. (defun list-replace-nth (list n new-value)
  2. "Return a new list equivalent to LIST, but with the NTH (zero-indexed) value of LIST repalced with NEW-VALUE."
  3. (let ((list (copy-list list)))
  4. (setf (nth n list) new-value)
  5. list))
Advertisement
Add Comment
Please, Sign In to add comment