[Haskell-beginners] Reversing the lines read from stdin
Rahul Kapoor
rk at trie.org
Thu Jan 28 15:53:12 EST 2010
> Anybody willing to post some rewrites?
> main = interact reverseFile
> reverseFile s = unlines $ lines $ foldr combineStr [] (lines s)
> combineStr s1 s2 = s2 ++ "\n" ++
I personally find the point-free version easier to read..
reverseFile = unlines . lines . foldr combineStr [] . lines
Vs
reverseFile s = unlines $ lines $ foldr combineStr [] (lines s)
More information about the Beginners
mailing list