Skip to content

Instantly share code, notes, and snippets.

@cdparks
Created January 6, 2014 03:02
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 cdparks/8277586 to your computer and use it in GitHub Desktop.
Save cdparks/8277586 to your computer and use it in GitHub Desktop.
import Data.Char (ord)
main = print $ rot13 "unccl oveguqnl, funqra!"
where
rot13 = foldr replace []
alpha = ['a'..'z']
index x = (ord x - ord 'a' + 13) `mod` 26
replace x xs
| x `elem` alpha = alpha !! index x:xs
| otherwise = x:xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment