Skip to content

Instantly share code, notes, and snippets.

@edvardm
Created October 13, 2014 13:16
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 edvardm/20b76086ed27c4b19f45 to your computer and use it in GitHub Desktop.
Save edvardm/20b76086ed27c4b19f45 to your computer and use it in GitHub Desktop.
rot13 = map (rot13' pairs) where
pairs = (zip s1 s2) ++ (zip s2 s1)
s1 = ['a'..'m'] ++ ['A'..'M'] ++ ['0'..'4']
s2 = ['n'..'z'] ++ ['N'..'Z'] ++ ['5'..'9']
rot13' [] ch = c
rot13' ((p,q):cs) c = if c == p then q else (rot13' cs c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment