Name: Jhonson 2011-03-09 5:06
Can you help me write a program that finds what lowercase symbols are used most in a binary file?
import System.Environment (getArgs)
import System.IO (readFile)
import Data.List (sort)
import Data.Array (accumArray, assocs, inRange)
swap (x, y) = (y, x)
main = print =<< return . reverse . sort . map swap . assocs . accumArray (+) 0 ('a', 'z') . flip zip (repeat 1) . filter (inRange ('a', 'z')) . concat =<< mapM readFile =<< getArgs