sorted-histogram ( seq -- alist ) (original) (raw)

sorted-histogram ( seq -- alist )
Statistics » Computing histograms

Prev: histogram! ( hashtable seq -- hashtable )

Vocabulary
math.statistics

Inputs

seq a sequence

Outputs

alist an array of key/value pairs

Word description
Outputs a histogram of a sequence sorted by number of occurrences from lowest to highest.

Examples

USING: prettyprint math.statistics ; "abababbbbbbc" sorted-histogram .
{ { 99 1 } { 97 3 } { 98 8 } }

Definition

USING: sorting ;

IN: math.statistics

: sorted-histogram ( seq -- alist ) histogram sort-values ;