Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Data.List (group, sort)
- import Text.Printf (printf,)
- get_ext = reverse . takeWhile (/='.') . reverse
- get_groups = group . sort . map get_ext . lines
- get_all_pairs txt = [ (length g, head g) | g <- get_groups txt ]
- printer = mapM_ $ uncurry $ printf "%3d %s\n"
- main = readFile "massa.txt" >>= printer . reverse . sort . get_all_pairs
- -- Based on https://www.facebook.com/pythonbrasil/photos/a.582882565067606.1073741825.328258703863328/776054062417121/
Advertisement
Add Comment
Please, Sign In to add comment