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

Support transducers? #27

Open
tkf opened this issue May 25, 2020 · 0 comments
Open

Support transducers? #27

tkf opened this issue May 25, 2020 · 0 comments

Comments

@tkf
Copy link

tkf commented May 25, 2020

Is there any chance you can support transducers in groupreduce? Roughly speaking it's "just" rewriting

acc = init
for x in xs
    acc = op(acc, x)
end

to

acc = start(op, init)
for x in xs
    acc = next(op, acc, x)
    acc isa Reduced && return acc  # required only for terminatable transducers
end
acc = complete(op, acc)

This way, I can pass op = reducingfunction(transducer, original_op) to groupreduce. It is useful for complex per-group operations fused with the reduction. I can split the abstract interface in a separate package if requiring whole Transducers.jl is not ideal.

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