Transducers.jl icon indicating copy to clipboard operation
Transducers.jl copied to clipboard

`combine` fails for `GroupBy` when reducing function is bare lambda

Open ExpandingMan opened this issue 1 year ago • 1 comments

I discuss this issue in some more detail in this PR. In summary, combine needs an inner reducing function from the rf argument, but it can't get it if it is supplied directly with a bare anonymous function (i.e. a Reduction is needed). I added some documentation in that PR so that users will know what to do if it gets merged, but a real fix is needed. Doing this without breaking changes will be difficult.

ExpandingMan avatar Jul 14 '23 19:07 ExpandingMan

One possibility which I think would be non-breaking is

struct GroupBy{K, R, IR, T} <: Transducer
    key::K
    rf::R
    inner_rf::IR
    init::T
end

function GroupBy(key, rf, init, inner_rf=rf)
end

but it's a bit wonky and almost definitely not how it would have been done if it were done right in the first place.

ExpandingMan avatar Jul 14 '23 19:07 ExpandingMan