repl.txt (856B)
1 2 {{alias}}() 3 Returns an accumulator function which incrementally computes a sum of 4 products. 5 6 If provided input values, the accumulator function returns an updated sum. 7 If not provided input values, the accumulator function returns the current 8 sum. 9 10 If provided `NaN` or a value which, when used in computations, results in 11 `NaN`, the accumulated value is `NaN` for all future invocations. 12 13 For long running accumulations or accumulations of large numbers, care 14 should be taken to prevent overflow. 15 16 Returns 17 ------- 18 acc: Function 19 Accumulator function. 20 21 Examples 22 -------- 23 > var accumulator = {{alias}}(); 24 > var s = accumulator() 25 null 26 > s = accumulator( 2.0, 3.0 ) 27 6.0 28 > s = accumulator( -5.0, 2.0 ) 29 -4.0 30 > s = accumulator() 31 -4.0 32 33 See Also 34 -------- 35