Handbook
Glossary
cum-max ( seq -- seq' )
Statistics
ยป
Computing cumulative sequences
Prev:
cum-min ( seq -- seq' )
Next:
cum-count ( seq quot: ( elt -- ? ) -- seq' )
Vocabulary
math
.
statistics
Inputs
seq
a
sequence
Outputs
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
]
accumulate*
;