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