- (define (no-repeating-digits max)
- (filter (lambda (anum) (not (dup-char? (string->list (number->string anum)) empty)))
- (mk-number-lst max empty)))
- (define (mk-number-lst max alon)
- (cond [(empty? alon) (mk-number-lst max (list 1))]
- [(cons? alon) (cond [(>= (first alon) max) alon]
- [else (mk-number-lst max (cons (+ (first alon) 1) alon))])]))
- (define (dup-char? top bottom)
- (cond [(empty? top) false]
- [(cons? top) (cond [(not (empty? (filter (lambda (achar) (char=? (first top) achar))
- (append (rest top) bottom)))) true]
- [else (dup-char? (rest top) (cons (first top) bottom))])]))
Posted by Anonymous on Sat 25 Oct 00:57
report abuse | download | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.