summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeather Miller <heather.miller@epfl.ch>2013-01-08 13:19:51 +0100
committerHeather Miller <heather.miller@epfl.ch>2013-01-08 13:42:12 +0100
commit0f237e90285a635855a7b093bd997ca2f2a4ccd1 (patch)
treebaf26290d7b4c4ca1a85a9926e41751f63db6b5c /src
parent1381cda86ddeca1b9829a9c53ff9372cfd816735 (diff)
downloadscala-0f237e90285a635855a7b093bd997ca2f2a4ccd1.tar.gz
scala-0f237e90285a635855a7b093bd997ca2f2a4ccd1.tar.bz2
scala-0f237e90285a635855a7b093bd997ca2f2a4ccd1.zip
SI-6930 adds documentation to reduceLeft in TraversableOnce
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/collection/TraversableOnce.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/library/scala/collection/TraversableOnce.scala b/src/library/scala/collection/TraversableOnce.scala
index d53d000e90..a448ac2c09 100644
--- a/src/library/scala/collection/TraversableOnce.scala
+++ b/src/library/scala/collection/TraversableOnce.scala
@@ -148,6 +148,20 @@ trait TraversableOnce[+A] extends Any with GenTraversableOnce[A] {
def foldRight[B](z: B)(op: (A, B) => B): B =
reversed.foldLeft(z)((x, y) => op(y, x))
+ /** Applies a binary operator to all elements of this $coll,
+ * going left to right.
+ * $willNotTerminateInf
+ * $orderDependentFold
+ *
+ * @param op the binary operator.
+ * @tparam B the result type of the binary operator.
+ * @return the result of inserting `op` between consecutive elements of this $coll,
+ * going left to right:
+ * {{{
+ * op( op( ... op(x_1, x_2) ..., x_{n-1}), x_n)
+ * }}}
+ * where `x,,1,,, ..., x,,n,,` are the elements of this $coll.
+ * @throws `UnsupportedOperationException` if this $coll is empty. */
def reduceLeft[B >: A](op: (B, A) => B): B = {
if (isEmpty)
throw new UnsupportedOperationException("empty.reduceLeft")