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.
Is there any chance you can support transducers in
groupreduce
? Roughly speaking it's "just" rewritingto
This way, I can pass
op = reducingfunction(transducer, original_op)
togroupreduce
. 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.