Skip to content

Instantly share code, notes, and snippets.

@jarnaldich

jarnaldich/1.rkt Secret

Forked from dvanhorn/1.rkt
Created August 28, 2011 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarnaldich/3151724e7ac74264c52e to your computer and use it in GitHub Desktop.
Save jarnaldich/3151724e7ac74264c52e to your computer and use it in GitHub Desktop.
#lang racket
(require srfi/13)
(define (translate s)
(let* ([a (char->integer #\a)]
[h (for/hash ([c (in-range 26)])
(values (integer->char (+ a c))
(integer->char (+ a (modulo (+ c 2) 26)))))])
(string-map (lambda (c) (hash-ref h c c)) s)))
(translate " 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.")
(translate "map")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment