repl.txt (1328B)
1 2 {{alias}}( iterator, W ) 3 Returns an iterator which iteratively computes a moving range. 4 5 The `W` parameter defines the number of iterated values over which to 6 compute the moving range. 7 8 As `W` values are needed to fill the window buffer, the first `W-1` returned 9 values are calculated from smaller sample sizes. Until the window is full, 10 each returned value is calculated from all previously iterated values. 11 12 If an environment supports Symbol.iterator, the returned iterator is 13 iterable. 14 15 Parameters 16 ---------- 17 iterator: Object 18 Input iterator. 19 20 W: integer 21 Window size. 22 23 Returns 24 ------- 25 iterator: Object 26 Iterator. 27 28 iterator.next(): Function 29 Returns an iterator protocol-compliant object containing the next 30 iterated value (if one exists) and a boolean flag indicating whether the 31 iterator is finished. 32 33 iterator.return( [value] ): Function 34 Finishes an iterator and returns a provided value. 35 36 Examples 37 -------- 38 > var arr = {{alias:@stdlib/array/to-iterator}}( [ 2.0, -5.0, 3.0, 5.0 ] ); 39 > var it = {{alias}}( arr, 3 ); 40 > var m = it.next().value 41 0.0 42 > m = it.next().value 43 7.0 44 > m = it.next().value 45 8.0 46 > m = it.next().value 47 10.0 48 49 See Also 50 -------- 51