reduceLeft
trait Collection[A] {
def reduceLeft[B :> A](op: (B, A) => B): B
}
reduceLeft
applies the binary operator op
to each element, going from left to right, and the previous op
result.
The first time op
is applied it’s fed with the two first elements.
On single-element collections that only element is returned and the binary operator op
is not applied.
On empty collections this function throws an UnsupportedOperationException
exception.