The scan method takes an associative binary operator function as parameter and will use it to collapse elements from the collection to create a running total from each element. Similar to the fold method, scan allows you to also specify an initial value.
defscan[B >: A, That](z: B)(op: (B, B) ⇒ B)(implicit cbf: CanBuildFrom[Repr, B, That]): That