Skip to content

Commit

Permalink
Make Compat.(map)reduce work without given dims
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Jul 11, 2018
1 parent f9d01f1 commit 356cdd6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1795,9 +1795,11 @@ if VERSION < v"0.7.0-DEV.4064"
reduce(op, a, dims=dims, init=v0)
elseif VERSION < v"0.7.0-beta.81" # julia#27711
mapreduce(f, op, a::AbstractArray; dims=nothing, init=nothing) =
init === nothing ? Base.mapreduce(f, op, a; dims=dims) : Base.mapreduce(f, op, init, a; dims=dims)
init === nothing ? (dims===nothing ? Base.mapreduce(f, op, a) : Base.mapreduce(f, op, a, dims=dims)) :
(dims===nothing ? Base.mapreduce(f, op, init, a) : Base.mapreduce(f, op, init, a, dims=dims))
reduce(op, a::AbstractArray; dims=nothing, init=nothing) =
init === nothing ? Base.reduce(op, a; dims=dims) : Base.reduce(op, init, a; dims=dims)
init === nothing ? (dims===nothing ? Base.reduce(op, a) : Base.reduce(op, a, dims=dims)) :
(dims===nothing ? Base.reduce(op, init, a) : Base.reduce(op, init, a, dims=dims))
end
if VERSION < v"0.7.0-DEV.4534"
reverse(a::AbstractArray; dims=nothing) =
Expand Down

0 comments on commit 356cdd6

Please sign in to comment.