如何删除列表的重复项?(运行时间为 O(n log n) )例如:'(4 6 1 1 2 3 3 5 6) => '(4 6 1 2 3 5)
(define (re-dup lst)
(cond
((empty? lst) empty)
(else
(define el (first lst))
(define el-free-lst (filter (lambda (x) (not (= el x))) (rest lst)))
(cons el (re-dup el-free-lst)))))
这是正确的吗?