Sample input:
a =
[("eo","th"),("or","he")]
Sample output:
[('e','t'),('o','h'),('o','h'),('r','e')]
ListUtil.hs
process :: [(String,String)] -> [(Char, Char)] process [] = [] process ((first, second):xs) = (head first, head second) : (head (tail first), head(tail second)) : (process xs)
Prelude> :load ListUtil.hs [1 of 1] Compiling Main ( ListUtil.hs, interpreted ) Ok, modules loaded: Main. *Main> *Main> process [("eo","th"),("or","he")] [('e','t'),('o','h'),('o','h'),('r','e')] *Main>
No comments:
Post a Comment