Skip to content

Commit

Permalink
Fix sum(::AbstractArray{Bool}; dims)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Jun 8, 2020
1 parent b8a686b commit 749e2ce
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions base/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}; kw...) =
kw === NamedTuple() ? count(a) : reduce(add_sum, a; kw...)

## prod
"""
Expand Down

0 comments on commit 749e2ce

Please sign in to comment.