Non-decimal radices/Convert: Difference between revisions
Content added Content deleted
(Added Haskell example) |
|||
Line 194: | Line 194: | ||
toAlphaDigits = map convert where |
toAlphaDigits = map convert where |
||
convert n | n < 10 = chr (n + ord '0') |
convert n | n < 10 = chr (n + ord '0') |
||
| otherwise = chr (n + ord 'a') |
| otherwise = chr (n + ord 'a' - 10) |
||
fromAlphaDigits :: String -> [Int] |
fromAlphaDigits :: String -> [Int] |