Created
February 25, 2013 06:30
-
-
Save blast-hardcheese/5028140 to your computer and use it in GitHub Desktop.
Rewriting this to solve PythonChallenge level 23. It works, but it's not very readable. Suggestions welcome.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val map = { | |
type Dict = Map[Char, Char] | |
val initial = Map[Char, Char]() | |
(for(c <- List('A', 'a'); i <- 0 until 26) yield { | |
((i + c).toChar, ((i + 13) % 26 + c).toChar) | |
}).foldLeft[Dict](initial)({ (map, kv) => | |
val (k, v) = kv | |
map.updated(k, v) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment