Created
February 20, 2015 21:12
-
-
Save chunkzer/366f0520115b5647aa9b to your computer and use it in GitHub Desktop.
capi en haskell
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
| import Data.List.Split | |
| import Data.List | |
| import Data.Char | |
| subAbc = ([" "] ++ [" "] ++ splitEvery 3 ['A'..'O']) ++ [['P'..'S']] ++ [['T'..'V']] ++ [['W'..'Z']] | |
| indexmap a = map (findIndices (==a)) subAbc | |
| finder a = (findIndices (not . null) (indexmap a) !! 0 , (concat (indexmap a))!!0) | |
| codificador x = map (intToDigit) (replicate ((snd x)+1) (((fst x)))) | |
| espacios [] = [] | |
| espacios (x:y:xs) = if (x!!0 == y!!0) then x:" ":espacios(y:xs) else x:espacios(y:xs) | |
| espacios [x] = x:[] | |
| oldSchoolTxt x = concat (espacios (map (codificador) (map (finder) x))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment