summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorDaniel C. Sobral <dcsobral@gmail.com>2012-01-14 13:17:26 -0200
committerDaniel C. Sobral <dcsobral@gmail.com>2012-01-14 13:17:26 -0200
commitec11e47567404c95dc1ee5dd4ddbcd9e7de69779 (patch)
treea07bed19c4b346f61d514372aa4b5bd6ec7ab8c1 /src/library
parent545680b2746cc0c7ae658f6c66e68e763b0b58c9 (diff)
downloadscala-ec11e47567404c95dc1ee5dd4ddbcd9e7de69779.tar.gz
scala-ec11e47567404c95dc1ee5dd4ddbcd9e7de69779.tar.bz2
scala-ec11e47567404c95dc1ee5dd4ddbcd9e7de69779.zip
Reword confusing explanation
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/PartialFunction.scala18
1 files changed, 11 insertions, 7 deletions
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)
* }}}
*