reduceRight
trait Collection[A] {
def reduceRight[B :> A](op: (A, B) => B): B
}
reduceRight
applies the binary operator op
to each element, going from right to left, and the previous op
result.
The first time op
is applied it’s fed with the last two 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.