It looks like you use the invariant here that apply will be called regularly.  Could you document that?

What makes this different from an exponential moving average?  Could you just use that instead?