cum-max ( seq -- seq' )
Statistics > Computing cumulative sequences
Prev:cum-min ( seq -- seq' )
Next:cum-count ( seq quot -- seq' )


Vocabulary
math.statistics

Inputs and outputs
seqa sequence
seq'a sequence


Word description
Returns the cumulative max of seq.

Examples
USING: math.statistics prettyprint ; { 1 -1 3 5 } cum-max .
{ 1 1 3 5 }


Definition
USING: kernel math.order sequences ;

IN: math.statistics

: cum-max ( seq -- seq' ) dup ?first [ max ] cum-map ;