Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
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
seq
a
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
;