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

Iterators: Create accumulate op as "asymmetric" version of reduce #618

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ingomueller-net
Copy link
Collaborator

This PR introduces a new AccumulateOp as an asymmetric version of ReduceOp. The two ops are similar, and we should discuss whether it makes sense to keep both, but accumulate as implemented in this PR allows to do things that reduce doesn't, for example, to "accumulate" elements into a container: accumulate(container, element): container.insert(element). In the current version of reduce, we force the signature to be (T, T) -> T, whereas accumulate allows for (T1, T2) -> T1 (which, at the same time, requires the definition of an empty accumulator value).

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

Successfully merging this pull request may close these issues.

1 participant