Haskell for Perl ProgrammersArraysHistogram

5.1. Histogram

hist
:: (Ix a, Integral b)
=> (a,a)
-> [a]
-> Array a b
hist bnds is
=  accumArray (
+)
0 bnds [(i,
1)
| i
<- is, inRange bnds i]

Written by Shlomi Fish