I learn lisp a few days ago, and I want to do is like following
1 `(1 2 3 4 1 5) ==> ( 2 3 4 1 5)
What I cand do is to remove all the occurence, I cannot figure out how to preserve the last symbol.
here is my code
(defun test (X L)
(cond ((null L) nil)
((equal X (last L)) (test X (butlast L)))
(t (cons (test X (butlast L)) (last L)))))
Thx for your reading my question !
Here you go, recursive, but not very efficient solution: