coding style - Simplifying an ugly function in Haskell -
i have defined function f1
f1 p = foldl (\x y -> x ++ y ++ "\t") "" (map (foldl (++) "") p) that take
[["4","0","1"],["5","2","3"]] and yield
"401\t523\t" but function ugly can get. sure there simpler way implement same function. can give me clue it?
function composition friend. intercalate, data.list
f1 = intercalate "\t" . map concat edit: whoops, misread output. want "\t" @ end of of them, not between them. in case, it's closer to
f1 = concat . map ((++ "\t") . concat)
Comments
Post a Comment