Skip to content

Instantly share code, notes, and snippets.

@arbuztw
Last active May 10, 2018
Embed
What would you like to do?
import Data.Bool
histogram :: [Int] -> String
histogram xs = unlines . reverse . (['0'..'9']:) . ("==========":) . map (flip map counts . (bool ' ' '*' .) . (<=)) $ [1..height]
where
counts = map (flip ((length.) . filter) xs . (==)) [0..9]
height = maximum counts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment