We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
mapreduce
1 parent b14a1dd commit e149bacCopy full SHA for e149bac
src/array-lib.jl
@@ -372,8 +372,7 @@ end
372
Term{Any}(_mapreduce, [f, g, x, dims, (kw...,)]))
373
end false
374
375
-for (ff, opts) in [sum => (identity, +, false),
376
- prod => (identity, *, true),
+for (ff, opts) in [
377
any => (identity, (|), false),
378
all => (identity, (&), true)]
379
@@ -387,3 +386,17 @@ for (ff, opts) in [sum => (identity, +, false),
387
386
mapreduce(f, $g, x, dims=dims, init=init)
388
389
end
+
390
+for (ff, opts) in [sum => (identity, +),
391
+ prod => (identity, *)]
392
393
+ f, g = opts
394
+ @eval @wrapped function (::$(typeof(ff)))(x::AbstractArray;
395
+ dims=:, kw...)
396
+ mapreduce($f, $g, x, dims=dims, kw...)
397
+ end false
398
+ @eval @wrapped function (::$(typeof(ff)))(f::Function, x::AbstractArray;
399
400
+ mapreduce(f, $g, x, dims=dims, kw...)
401
402
+end
0 commit comments