Eli Barzilay <eli@...> writes: > (define (translate str) > (define A (char->integer #\a)) > (define (rotate x) (+ A (modulo (- x A -2) 26))) > (regexp-replace* #rx#"[a-z]" str (λ (m) (bytes (rotate (bytes-ref m 0))))))
That's definitely better. Hadn't read the docs for regexp-replace close enough... hope you don't mind if I paste this into the challenge wiki? > In any case, it's easy to write some tr-style utility, the question is > whether it has any practical use. (I've seen a number, they were all > from such toys.) I don't think a tr library would be that useful if you can just pass a lambda to regexp-replace... _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users