trailingFUN function

apply a function over a configurable trailing period