mapreduce(f, op, itr)

..  mapreduce(f, op, itr)

Like ``mapreduce(f, op, v0, itr)``. In general, this cannot be used
with empty collections (see ``reduce(op, itr)``).

Examples


julia> mapreduce(x->x*x, +, [1,2,3])
14

julia> mapreduce((x) -> x^3, +, 9, [1:3])   #  = 9 + 1 + 8 + 27
45
julia> mapreduce((x) -> -x, *, [8:10])      #   = -8 * -9 * -10
-720```

See Also

foldl, foldr, mapfoldl, mapfoldr, mapreduce, mapreducedim,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: