cl:duplicates   scheme


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

Implementation

;;;@ keep only MEMBERs of a list which occur more than once
(define cl:duplicates
  (lambda (lst)
    (let loop ((rem lst)
               (dupes '()))
      (if (null? rem)
          (reverse dupes)
          (loop (cdr rem)
                (if (member (car rem) (cdr rem))
                    (cons (car rem) dupes)
                    dupes))))))


Back to Index

Similar Entries