From 0f237e90285a635855a7b093bd997ca2f2a4ccd1 Mon Sep 17 00:00:00 2001 From: Heather Miller Date: Tue, 8 Jan 2013 13:19:51 +0100 Subject: SI-6930 adds documentation to reduceLeft in TraversableOnce --- src/library/scala/collection/TraversableOnce.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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") -- cgit v1.2.3