B. Pym
2024-07-21 00:02:23 UTC
(defun rem-duplicates (list)
(loop for (first . rest) on (append list list)
unless (member first (reverse rest) :test #'equal)
collect first))
Gauche Scheme(loop for (first . rest) on (append list list)
unless (member first (reverse rest) :test #'equal)
collect first))
(define (rem-dups lst)
(fold
(lambda (x accum) (if (member x accum) accum (cons x accum)))
'()
lst))
(rem-dups '(0 2 3 4 (8 7) 3 2 0 (8 7)))
===>
(4 3 2 0 (8 7))