diff --git a/base/reduce.jl b/base/reduce.jl index 3e97db3e1afba8..102b016a9f2a20 100644 --- a/base/reduce.jl +++ b/base/reduce.jl @@ -523,9 +523,8 @@ julia> sum(1:20) ``` """ sum(a; kw...) = sum(identity, a; kw...) -sum(a::AbstractArray{Bool}; kw...) = count(a) -# Note: It is OK to ignore `init` to `sum(::AbstractArray{Bool})` -# because it is unspecified if the value of `init` is used or not. +sum(a::AbstractArray{Bool}; init = nothing, kw...) = + init === nothing ? count(a; kw...) : reduce(add_sum, a; init = init, kw...) ## prod """