prefixLength

trait Collection[A] {
  def prefixLength(p: (A) => Boolean): Int
}

prefixLength returns the length of the largest prefix of elements that satisfy the predicate p.