Handbook
Glossary
cum-mean ( seq -- seq' )
Vocabulary
math
.
statistics
Inputs
seq
a
sequence
Outputs
seq'
a
sequence
Word description
Returns the cumulative mean of
seq
.
Examples
USING: math.statistics prettyprint ; { 1.0 2.0 3.0 } cum-mean .
{ 1.0 1.5 2.0 }
Definition
USING:
kernel
math
sequences
;
IN:
math.statistics
:
cum-mean
( seq -- seq' )
0
swap
[
[
+
dup
]
dip
1
+
/
]
map-index
nip
;