Skip to content

Instantly share code, notes, and snippets.

@BookGin
Created May 8, 2018 04:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BookGin/96a217b8eb484391146f67d932241381 to your computer and use it in GitHub Desktop.
Save BookGin/96a217b8eb484391146f67d932241381 to your computer and use it in GitHub Desktop.
histogram
histogram a = concat (map (++"\n") ([concat [if c!!j >= i then "*" else " " | j <- [0..9]] | i <- reverse [1..maximum c]] ++ ["==========", "0123456789"]))
where c = [length (filter (==i) a) | i <- [0..9]]
-- putStrLn d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment