cum-count ( seq quot: ( elt -- ? ) -- seq' )
Statistics ยป Computing cumulative sequences

Prev:cum-max ( seq -- seq' )


Vocabulary
math.statistics

Inputs
seqa sequence
quota quotation with stack effect ( elt -- ? )


Outputs
seq'a sequence


Word description
Returns the cumulative count of how many times quot returns true.

Examples
USING: math math.statistics prettyprint ; { 1 -1 2 -1 4 } [ 0 < ] cum-count .
{ 0 1 1 2 2 }


Definition