histogram ( seq -- hashtable )
Statistics > Computing histograms
Next:histogram-by ( seq quot: ( x -- bin ) -- hashtable )


Vocabulary
math.statistics

Inputs and outputs
seqa sequence
hashtablea hashtable


Word description
Returns a hashtable where the keys are the elements of the sequence and the values are the number of times they appeared in that sequence.

Examples
! Count the number of times an element appears in a sequence. USING: prettyprint math.statistics ; "aaabc" histogram .
H{ { 97 3 } { 98 1 } { 99 1 } }


Definition
IN: math.statistics

: histogram ( seq -- hashtable ) [ ] histogram-by ;