#!r6rs (library (distinct) (export distinct?) (import (rnrs)) (define (distinct? eq? items) (if (null? items) #t (let* ((first (car items)) (rest (cdr items))) (cond ((or (exists (lambda (i) (eq? first i)) rest) (not (distinct? eq? rest))) #f) (else #t))))) )