repl.txt (1113B)
1 2 {{alias}}( W ) 3 Returns an accumulator function which incrementally computes a moving sum of 4 products. 5 6 The `W` parameter defines the number of (x,y) pairs over which to compute 7 the moving sum of products. 8 9 If provided input values, the accumulator function returns an updated moving 10 sum. If not provided input values, the accumulator function returns the 11 current moving sum. 12 13 As `W` (x,y) pairs are needed to fill the window buffer, the first `W-1` 14 returned values are calculated from smaller sample sizes. Until the window 15 is full, each returned value is calculated from all provided values. 16 17 Parameters 18 ---------- 19 W: integer 20 Window size. 21 22 Returns 23 ------- 24 acc: Function 25 Accumulator function. 26 27 Examples 28 -------- 29 > var accumulator = {{alias}}( 3 ); 30 > var s = accumulator() 31 null 32 > s = accumulator( 2.0, 3.0 ) 33 6.0 34 > s = accumulator( -5.0, 2.0 ) 35 -4.0 36 > s = accumulator( 3.0, -2.0 ) 37 -10.0 38 > s = accumulator( 5.0, 3.0 ) 39 -1.0 40 > s = accumulator() 41 -1.0 42 43 See Also 44 -------- 45