7 ms·
ghc -e 'interact $ unlines . map reverse . lines'
by joeyh 12y ago
ghc -e 'interact $ unlines . map reverse . lines'
- vertex-four 12y agoOr, on any *nix worth talking about, by default... perl -e 'print reverse <>'
- dbaupp 12y agoIsn't that `rev`, not `tac`? (I think `tac` should be `unlines . reverse . lines`.)
- wyager 12y agoYou are correct. For those not familiar with Haskell, unlines . map reverse . lines is the same thing as (python) lambda data : [line[::-1] for line in data] whereas unlines . reverse. lines is the same as lambda data : [line for line in data][::-1]
- dbaupp 12y agoWell, you need '\n'.join(...) for the "unlines" bit.