Skip to content

Commit

Permalink
note that reduction associativity is implementation-dependent (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Aug 16, 2013
1 parent 5d5de41 commit 73153f5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/stdlib/base.rst
Expand Up @@ -432,6 +432,10 @@ Iterable Collections

Reduce the given collection with the given operator, i.e. accumulate ``v = op(v,elt)`` for each element, where ``v`` starts as ``v0``. Reductions for certain commonly-used operators are available in a more convenient 1-argument form: ``max(itr)``, ``min(itr)``, ``sum(itr)``, ``prod(itr)``, ``any(itr)``, ``all(itr)``.

The associativity of the reduction is implementation-dependent; if you
need a particular associativity, e.g. left-to-right, you should write
your own loop.

.. function:: max(itr)

Returns the largest element in a collection
Expand Down Expand Up @@ -504,6 +508,10 @@ Iterable Collections

**Example**: ``mapreduce(x->x^2, +, [1:3]) == 1 + 4 + 9 == 14``

The associativity of the reduction is implementation-dependent; if you
need a particular associativity, e.g. left-to-right, you should write
your own loop.

.. function:: first(coll)

Get the first element of an ordered collection.
Expand Down Expand Up @@ -3089,6 +3097,10 @@ Array functions
vector specifying the dimensions to reduce, and ``initial`` is the initial
value to use in the reductions.

The associativity of the reduction is implementation-dependent; if you
need a particular associativity, e.g. left-to-right, you should write
your own loop.

.. function:: mapslices(f, A, dims)

Transform the given dimensions of array ``A`` using function ``f``. ``f``
Expand Down

0 comments on commit 73153f5

Please sign in to comment.