From ec11e47567404c95dc1ee5dd4ddbcd9e7de69779 Mon Sep 17 00:00:00 2001 From: "Daniel C. Sobral" Date: Sat, 14 Jan 2012 13:17:26 -0200 Subject: Reword confusing explanation --- src/library/scala/PartialFunction.scala | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/library') diff --git a/src/library/scala/PartialFunction.scala b/src/library/scala/PartialFunction.scala index ae2c343e0b..70caff0221 100644 --- a/src/library/scala/PartialFunction.scala +++ b/src/library/scala/PartialFunction.scala @@ -20,21 +20,25 @@ package scala * val f: PartialFunction[Int, Any] = { case _ => 1/0 } * }}} * - * The main distinction between `PartialFunction` and [[scala.Function1]] is that - * an alternative behavior can be applied to those elements that are declared - * to be outside its domain. For example: + * The main distinction between `PartialFunction` and [[scala.Function1]] is + * that the user of a `PartialFunction` may choose to do something different + * with input that is declared to be outside its domain. For example: * * {{{ * val sample = 1 to 10 - * val isEven: PartialFunction[Int, String] = { case x if x % 2 == 0 => x+" is even" } + * val isEven: PartialFunction[Int, String] = { + * case x if x % 2 == 0 => x+" is even" + * } * * // the method collect can use isDefinedAt to select which members to collect * val evenNumbers = sample collect isEven * - * val isOdd: PartialFunction[Int, String] = { case x if x % 2 == 1 => x+" is odd" } + * val isOdd: PartialFunction[Int, String] = { + * case x if x % 2 == 1 => x+" is odd" + * } * - * // the method orElse allows chaining another partial function to handle input - * // outside the declared domain + * // the method orElse allows chaining another partial function to handle + * // input outside the declared domain * val numbers = sample map (isEven orElse isOdd) * }}} * -- cgit v1.2.3