So I'm trying to make a function takes in a list and reverses in place it but I'm not sure how I would use the RPLACA
/RPLACD
/NONC
. Basically does the same thing as reverse but it uses the cons nodes of the original list and does not allocate any new cons nodes. What I have so far is
(defun rip(lst)
(cond (( null lst) 0)
((eq (nil) (cdr (last lst))) 1)
(((setq x (car (last lst)))
(rplaca (car (last lst)) (car first lst))
(rplaca (car first lst) x)) + 2 rip(butlast(rest lst)))))