Created
July 7, 2014 15:46
-
-
Save heathermiller/1f0a82217f2b7652387f to your computer and use it in GitHub Desktop.
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 codeToChars: Map[Char, String] = | |
Map( | |
'2' -> "ABC", '3' -> "DEF", '4' -> "GHI", '5' -> "JKL", | |
'6' -> "MNO", '7' -> "PQRS", '8' -> "TUV", '9' -> "WXYZ" | |
) | |
/** | |
* Inverse of codeToChars, | |
* e.g. 'A' -> '2', 'B' -> '2'. | |
*/ | |
val charCode: Map[Char, Char] = | |
for { | |
(digit, chars) <- codeToChars | |
char <- chars | |
} yield char -> digit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment