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


Vocabulary
math.statistics

Inputs and outputs
hashtablea hashtable
seqa sequence


Word description
Takes an existing hashtable and uses histogram to continue counting the number of occurrences of each element.

Examples
! Count the number of times the elements of two sequences appear. USING: prettyprint math.statistics ; "aaabc" histogram "aaaaaabc" histogram! .
H{ { 97 9 } { 98 2 } { 99 2 } }


Definition
USING: assocs ;

IN: math.statistics

: histogram! ( hashtable seq -- hashtable )
[ ] [ inc-at ] sequence>assoc! ;