repl.txt (1509B)
1 2 {{alias}}( iterator, W ) 3 Returns an iterator which iteratively computes a moving mid-range. 4 5 The mid-range is the arithmetic mean of maximum and minimum values. 6 Accordingly, the mid-range is the midpoint of the range and a measure of 7 central tendency. 8 9 The `W` parameter defines the number of iterated values over which to 10 compute the moving mid-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 previously iterated values. 15 16 If an environment supports Symbol.iterator, the returned iterator is 17 iterable. 18 19 Parameters 20 ---------- 21 iterator: Object 22 Input iterator. 23 24 W: integer 25 Window size. 26 27 Returns 28 ------- 29 iterator: Object 30 Iterator. 31 32 iterator.next(): Function 33 Returns an iterator protocol-compliant object containing the next 34 iterated value (if one exists) and a boolean flag indicating whether the 35 iterator is finished. 36 37 iterator.return( [value] ): Function 38 Finishes an iterator and returns a provided value. 39 40 Examples 41 -------- 42 > var arr = {{alias:@stdlib/array/to-iterator}}( [ 2.0, -5.0, 3.0, 5.0 ] ); 43 > var it = {{alias}}( arr, 3 ); 44 > var v = it.next().value 45 2.0 46 > v = it.next().value 47 -1.5 48 > v = it.next().value 49 -1.0 50 > v = it.next().value 51 0.0 52 53 See Also 54 -------- 55