time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1040B)


      1 
      2 {{alias}}( W )
      3     Returns an accumulator function which incrementally computes a moving sum.
      4 
      5     The `W` parameter defines the number of values over which to compute the
      6     moving sum.
      7 
      8     If provided a value, the accumulator function returns an updated moving sum.
      9     If not provided a value, the accumulator function returns the current moving
     10     sum.
     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 s = accumulator()
     30     null
     31     > s = accumulator( 2.0 )
     32     2.0
     33     > s = accumulator( -5.0 )
     34     -3.0
     35     > s = accumulator( 3.0 )
     36     0.0
     37     > s = accumulator( 5.0 )
     38     3.0
     39     > s = accumulator()
     40     3.0
     41 
     42     See Also
     43     --------
     44