Every example I've seen uses isodd; I don't know if that's a coincidence or whether it's deliberate, but I expected
count.(grouped(first, ["apple", "pear", "artichoke"]))
to yield something like Dict('a' => 2, 'p' => 1). Instead I get
julia> count.(grouped(first, ["apple", "pear", "artichoke"]))
ERROR: TypeError: non-boolean (String) used in boolean context
Stacktrace:
[1] AsBool
@ ~/.julia/packages/LazyGroupBy/h6njR/src/LazyGroupBy.jl:160 [inlined]
[2] next
@ ~/.julia/packages/Transducers/AgX5g/src/library.jl:53 [inlined]
[3] (::Transducers.var"#69#71"{Char, Transducers.Reduction{Transducers.GroupBy{typeof(first), Transducers.Reduction{Transducers.Map{typeof(last)}, Transducers.Reduction{Transducers.Map{LazyGroupBy.AsBool{typeof(identity)}}, Transducers.BottomRF{typeof(+)}}}, Int64}, Transducers.BottomRF{Transducers.Completing{typeof(Transducers.right)}}}, String})(value::Nothing)
@ Transducers ~/.julia/packages/Transducers/AgX5g/src/groupby.jl:162
[4] generic_modify!!(f::Transducers.var"#69#71"{Char, Transducers.Reduction{Transducers.GroupBy{typeof(first), Transducers.Reduction{Transducers.Map{typeof(last)}, Transducers.Reduction{Transducers.Map{LazyGroupBy.AsBool{typeof(identity)}}, Transducers.BottomRF{typeof(+)}}}, Int64}, Transducers.BottomRF{Transducers.Completing{typeof(Transducers.right)}}}, String}, dict::Dict{Union{}, Union{}}, key::Char)
@ BangBang.Extras ~/.julia/packages/BangBang/d7e1M/src/extras.jl:86
[5] modify!!(f::Transducers.var"#69#71"{Char, Transducers.Reduction{Transducers.GroupBy{typeof(first), Transducers.Reduction{Transducers.Map{typeof(last)}, Transducers.Reduction{Transducers.Map{LazyGroupBy.AsBool{typeof(identity)}}, Transducers.BottomRF{typeof(+)}}}, Int64}, Transducers.BottomRF{Transducers.Completing{typeof(Transducers.right)}}}, String}, h::Dict{Union{}, Union{}}, key0::Char)
@ BangBang.Extras ~/.julia/packages/BangBang/d7e1M/src/extras.jl:97
[6] (::Transducers.var"#68#70"{Transducers.Reduction{Transducers.GroupBy{typeof(first), Transducers.Reduction{Transducers.Map{typeof(last)}, Transducers.Reduction{Transducers.Map{LazyGroupBy.AsBool{typeof(identity)}}, Transducers.BottomRF{typeof(+)}}}, Int64}, Transducers.BottomRF{Transducers.Completing{typeof(Transducers.right)}}}, String})(gstate::Dict{Union{}, Union{}}, iresult::Nothing)
@ Transducers ~/.julia/packages/Transducers/AgX5g/src/groupby.jl:156
[7] wrapping
@ ~/.julia/packages/Transducers/AgX5g/src/core.jl:707 [inlined]
[8] next
@ ~/.julia/packages/Transducers/AgX5g/src/groupby.jl:154 [inlined]
[9] macro expansion
@ ~/.julia/packages/Transducers/AgX5g/src/core.jl:181 [inlined]
[10] _foldl_array
@ ~/.julia/packages/Transducers/AgX5g/src/processes.jl:187 [inlined]
[11] __foldl__
@ ~/.julia/packages/Transducers/AgX5g/src/processes.jl:182 [inlined]
[12] #transduce#110
@ ~/.julia/packages/Transducers/AgX5g/src/processes.jl:518 [inlined]
[13] transduce
@ ~/.julia/packages/Transducers/AgX5g/src/processes.jl:515 [inlined]
[14] #transduce#109
@ ~/.julia/packages/Transducers/AgX5g/src/processes.jl:501 [inlined]
[15] transduce
@ ~/.julia/packages/Transducers/AgX5g/src/processes.jl:500 [inlined]
[16] #foldxl#115
@ ~/.julia/packages/Transducers/AgX5g/src/processes.jl:956 [inlined]
[17] #foldl#116
@ ~/.julia/packages/Transducers/AgX5g/src/processes.jl:959 [inlined]
[18] _impl_fold(fold::Function, kwargs::NamedTuple{(:init,), Tuple{Int64}}, rf::Function, xf::Transducers.Map{LazyGroupBy.AsBool{typeof(identity)}}, group::LazyGroupBy.GroupedBy{typeof(first), Vector{String}})
@ LazyGroupBy ~/.julia/packages/LazyGroupBy/h6njR/src/LazyGroupBy.jl:105
[19] impl(fold::typeof(foldl), kwargs::NamedTuple{(:init,), Tuple{Int64}}, rf::Function, xf::Transducers.Map{LazyGroupBy.AsBool{typeof(identity)}}, group::LazyGroupBy.GroupedBy{typeof(first), Vector{String}})
@ LazyGroupBy ~/.julia/packages/LazyGroupBy/h6njR/src/LazyGroupBy.jl:112
[20] impl(#unused#::typeof(count), #unused#::NamedTuple{(), Tuple{}}, group::LazyGroupBy.GroupedBy{typeof(first), Vector{String}})
@ LazyGroupBy ~/.julia/packages/LazyGroupBy/h6njR/src/LazyGroupBy.jl:162
[21] copy(bc::Base.Broadcast.Broadcasted{LazyGroupBy.GroupedByStyle, Nothing, typeof(count), Tuple{LazyGroupBy.GroupedBy{typeof(first), Vector{String}}}})
@ LazyGroupBy ~/.julia/packages/LazyGroupBy/h6njR/src/LazyGroupBy.jl:91
[22] materialize(bc::Base.Broadcast.Broadcasted{LazyGroupBy.GroupedByStyle, Nothing, typeof(count), Tuple{LazyGroupBy.GroupedBy{typeof(first), Vector{String}}}})
@ Base.Broadcast ./broadcast.jl:883
[23] top-level scope
@ REPL[16]:1
Every example I've seen uses
isodd; I don't know if that's a coincidence or whether it's deliberate, but I expectedto yield something like
Dict('a' => 2, 'p' => 1). Instead I get