foldLeft

trait Collection[A] {
  def foldLeft[B](z: B)(op: (B, A) => B): B
}

foldLeft applies, going from left to right, the binary operator op to each element and the previous op result. The first time op is applied it’s fed with the initial value z.

On empty collections this function doesn’t apply op and the initial value z is directly returned.