cl:remove-duplicates   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/scheme.xtm

Implementation

;;;@ remove duplicates of MEMBERs of a list
(define cl:remove-duplicates
   (letrec ((rem-dup  (lambda (lst nlst)
       (cond ((null? lst) (if (null? nlst) nlst (reverse nlst)))
             ((member (car lst) nlst) (rem-dup (cdr lst) nlst))
             (else (rem-dup (cdr lst) (cons (car lst) nlst)))))))
      (lambda (lst)
   (rem-dup lst '()))))


Back to Index