; distinct characters (define (distinct? str) (call-with-current-continuation (lambda (return) (let ((cs (string->list str))) (do ((cs cs (cdr cs))) ((null? cs) #t) (do ((ds (cdr cs) (cdr ds))) ((null? ds)) (when (char=? (car cs) (car ds)) (return #f)))))))) (display (distinct? "Programming")) (display " ") (display (distinct? "Praxis")) (newline) (define (distinct? str) (let loop ((cs (sort (string->list str) charlist str))) (if (null? cs) #t (if (hash-ref letters (car cs) #f) #f (begin (hash-set! letters (car cs) 1) (loop (cdr cs)))))))) (display (distinct? "Programming")) (display " ") (display (distinct? "Praxis")) (newline)