Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sliding window sums #98

Open
treeowl opened this issue Jun 4, 2020 · 0 comments
Open

Add sliding window sums #98

treeowl opened this issue Jun 4, 2020 · 0 comments

Comments

@treeowl
Copy link
Contributor

treeowl commented Jun 4, 2020

slidingWindowSum
  :: (Monad m, Semigroup s)
  => Int
  -> Stream (Of s) m r
  -> Stream (Of s) m r

This could be used for things like precise sliding window means.

Rather than carrying around a Seq s, this would carry a finger tree-like structure with s annotations. I think a structure like Okasaki's implicit queues, augmented with annotations, will probably do the trick quite nicely; we shouldn't need anything quite as heavy as Hinze-Paterson 2–3 finger trees.

Sliding window min and max could actually use this too, but those can sometimes free memory more quickly with a specialized implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant