Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/array-lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,7 @@ end
Term{Any}(_mapreduce, [f, g, x, dims, (kw...,)]))
end false

for (ff, opts) in [sum => (identity, +, false),
prod => (identity, *, true),
for (ff, opts) in [
any => (identity, (|), false),
all => (identity, (&), true)]

Expand All @@ -387,3 +386,15 @@ for (ff, opts) in [sum => (identity, +, false),
mapreduce(f, $g, x, dims=dims, init=init)
end false
end

for (ff, opts) in [sum => (identity, +),
prod => (identity, *)]

f, g = opts
@eval @wrapped function (::$(typeof(ff)))(x::AbstractArray; kw...)
mapreduce($f, $g, x; kw...)
end false
@eval @wrapped function (::$(typeof(ff)))(f::Function, x::AbstractArray; kw...)
mapreduce(f, $g, x; kw...)
end false
end
Loading