Re:Purely Functional Sliding Window Aggregation Algorithm
by gotoeleven on Monday February 24, 2025 @11:38AM
(#43161543)
How does this work for max rather than sum?
[ Parent
| on HN ]
Re:Purely Functional Sliding Window Aggregation Algorithm
by throwaway_1more on Monday February 24, 2025 @05:43PM
(#43165825)
Max is not like sum, you can just maintain one value over the window and update from new ones arriving immediately?
Re:Purely Functional Sliding Window Aggregation Algorithm
by BoiledCabbage on Tuesday February 25, 2025 @02:34AM
(#43169213)
Yes, but how do you update your max when you drop old values. That's the issue with max forming a monoid and not a group.
The whole point of the post is that this is easy to implement for sum, but is difficult for max. Posting how someone solves the problem for sum isn't really addressing anything new here.
Re:Purely Functional Sliding Window Aggregation Algorithm
by throwaway_1more on Saturday March 01, 2025 @12:42PM
(#43221591)
If the value you dropped wasn't the max, no problem, if it was, you recompute over the window. It is amortized.