histogram-by! ( assoc seq quot: ( x -- bin ) -- hashtable ) (original) (raw)

histogram-by! ( assoc seq quot: ( x -- bin ) -- hashtable )

Vocabulary
math.statistics

Inputs

assoc an object
seq an object
quot a quotation with stack effect ( x -- bin )

Outputs

hashtable an object

Definition

USING: assocs kernel sequences ;

IN: math.statistics

: histogram-by!
( assoc seq quot: ( x -- bin ) -- hashtable )
rot [ [ inc-at ] curry compose each ] keep ; inline