Skip to content

Instantly share code, notes, and snippets.

@dvanhorn

dvanhorn/1.rkt Secret

Created August 27, 2011 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dvanhorn/f8898fe28bd54852a745 to your computer and use it in GitHub Desktop.
Save dvanhorn/f8898fe28bd54852a745 to your computer and use it in GitHub Desktop.
#lang racket
(define str
"g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.")
(define (translate-char c)
(cond [(char-alphabetic? c)
(cond [(char=? #\z c) #\b]
[(char=? #\y c) #\a]
[else (integer->char (+ 2 (char->integer c)))])]
[else c]))
(define (translate-string s)
(apply string (map f (string->list s))))
(translate-string str)
(translate-string "map")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment