このページはまだ日本語に翻訳されていません。

condOpt

object PartialFunction {
  def condOpt[X, Y](x: X)(pf: PartialFunction[X, Y]): Option[Y]
}

condOpt accepts the value x and creates an anonymous partial function that in turn accepts the partial function pf, applies it to x and returns a Some wrapping the value returned by pf.

If pf is not defined for the input value x then the anonymous function returns None.