Skip to content

Commit a2defdc

Browse files
committed
Keep (map)reduce with positional v0 but dims keyword argument on Julia 0.6
1 parent 8e5b07f commit a2defdc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Compat.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,6 +1788,11 @@ if VERSION < v"0.7.0-DEV.4064"
17881788
(dims===nothing ? Base.reduce(op, init, a) : Base.reducedim(op, a, dims, init))
17891789
accumulate!(op, out, a; dims=nothing) =
17901790
dims===nothing ? Base.accumulate!(op, out, a) : Base.accumulate!(op, out, a, dims)
1791+
# kept for compatibility with early adopters
1792+
mapreduce(f, op, v0, a::AbstractArray; dims=nothing) =
1793+
mapreduce(f, op, a, dims=dims, init=v0)
1794+
reduce(op, v0, a::AbstractArray; dims=nothing) =
1795+
reduce(op, a, dims=dims, init=v0)
17911796
elseif VERSION < v"0.7.0-beta.81" # julia#27711
17921797
mapreduce(f, op, a::AbstractArray; dims=nothing, init=nothing) =
17931798
init === nothing ? Base.mapreduce(f, op, a; dims=dims) : Base.mapreduce(f, op, init, a; dims=dims)

0 commit comments

Comments
 (0)