Skip to content

Instantly share code, notes, and snippets.

@chunkzer
Created February 20, 2015 21:12
Show Gist options
  • Select an option

  • Save chunkzer/366f0520115b5647aa9b to your computer and use it in GitHub Desktop.

Select an option

Save chunkzer/366f0520115b5647aa9b to your computer and use it in GitHub Desktop.
capi en haskell
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