duplicates   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/adt.xtm

Implementation

(bind-func duplicates:[List{!a}*,List{!a}*]*
  (lambda (lst)
    (let ((dupes (list)))
      (while (not (null? lst))
        (if (not (null? (member (car lst) (cdr lst))))
            (set! dupes (cons (car lst) dupes)))
        (set! lst (cdr lst)))
      (reverse dupes))))


Back to Index

Similar Entries

  • cl:duplicates    scheme
  • cl:has-duplicates?    scheme
  • cl:remove-duplicates    scheme