Handbook
Glossary
cum-sum0 ( seq -- seq' )
Statistics
ยป
Computing cumulative sequences
Prev:
cum-sum ( seq -- seq' )
Next:
cum-product ( seq -- seq' )
Vocabulary
math
.
statistics
Inputs
seq
a
sequence
Outputs
seq'
a
sequence
Word description
Returns the cumulative sum of
seq
starting with 0 and not including the whole sum.
Examples
USING: math.statistics prettyprint ; { 1 -1 2 -1 4 } cum-sum0 .
{ 0 1 0 2 1 }
Definition
USING:
kernel
math
sequences
;
IN:
math.statistics
:
cum-sum0
( seq -- seq' )
0
[
+
]
accumulate
nip
;