; This is a function that takes a string and returns it rot13-encoded ; example: ; (rot13 "grkg gb qrpbqr") (define rot13 (lambda (text) (define char (lambda (c) (string (integer->char (cond ((and (char>=? c #\a) (char<=? c #\z)) (+ (remainder(+ (- (char->integer c) (char->integer #\a)) 13) 26 ) (char->integer #\a))) ((and (char>=? c #\A) (char<=? c #\Z)) (+ (remainder(+ (- (char->integer c) (char->integer #\A)) 13) 26 ) (char->integer #\A))) (else (char->integer c)) ) )) )) (if (> (string-length text) 1) (string-append (char (string-ref text 0)) (rot13 (substring text 1 (string-length text)))) (char (string-ref text 0)) ) ))