I am trying to run this code that supposedly removes duplicates from a sorted list of numbers.
(defun unique (x)
(cond( (null x) x )
( (null (cdr x)) x )( (equal (car x) (cdr x)) (unique (cdr x)) )( t (cons (car x) (unique (cdr x))) )))
I am trying to call this function by typing:
(print (unique '(2 2 3 4 4 5)))
My output is currently shown as follows:
(2 2 3 4 4 5)
Clearly, this doesn't seem to be removing the duplicates, if anything at all.