Is it possible to create custom sliding function similar to cumulativeSum?

I can write any own Aggregate function use reduce function, but i can’t find way to crate custom “window function” for example “cumulativeSum”

to implement such a function, an analogue of the function reduce that collects the value at each step of the aggregation.