Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #lang racket
- (require racket/format)
- (define meno "bazik")
- (define (wlength w)
- (~a (string-length w) #:min-width 7
- #:align 'right))
- (define (wformat w)
- (~a w #:max-width 127
- #:limit-marker "..."))
- (define (wfindrule rules x)
- (if (equal? (car (car rules)) x)
- (cdr (car rules))
- (wfindrule (cdr rules) x)))
- (define (wstep rules w n)
- (cond
- [(< n 0) ""]
- [(= n 0) w]
- [else (string-append (wfindrule rules (car (string->list w))) (wstep rules (list->string (cdr (string->list w))) (sub1 n)))]))
- (define (detNicnajderUtil steps rules w)
- (when (>= steps 0)
- (printf "~a: ~a\n" (wlength (wstep rules w (string-length w))) (wformat (wstep rules w (string-length w))))
- (detNicnajderUtil (sub1 steps) rules (wstep rules w (string-length w)))))
- (define (detNicnajder steps rules w)
- (begin
- (printf "~a: ~a\n" (wlength w) (wformat w))
- (detNicnajderUtil (sub1 steps) rules w)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement