summaryrefslogtreecommitdiff
path: root/src/library/scala/Function2.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-02-20 06:51:57 +0000
committerPaul Phillips <paulp@improving.org>2011-02-20 06:51:57 +0000
commitfd1ca1e63c876046936f681be26730a301da8ff2 (patch)
tree6db9fac72b958af0df8c51eeae8478c0fe5b6a98 /src/library/scala/Function2.scala
parent6a570deed1790889f7036a00c045c15217313587 (diff)
downloadscala-fd1ca1e63c876046936f681be26730a301da8ff2.tar.gz
scala-fd1ca1e63c876046936f681be26730a301da8ff2.tar.bz2
scala-fd1ca1e63c876046936f681be26730a301da8ff2.zip
Moved unlift to the Function companion object, ...
Moved unlift to the Function companion object, which might have been better in the first place. Had to make a minor change to genprod, and then I couldn't escape that unscathed. Finished the not very complete undertaking I found there to update the scaladoc. Lots of little changes to the generated text and code. I changed genprod to only put a unique stamp on Function0 so we can stop having a 100 file diff everytime an i is dotted somewhere. Closes #3825, no review.
Diffstat (limited to 'src/library/scala/Function2.scala')
-rw-r--r--src/library/scala/Function2.scala33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/library/scala/Function2.scala b/src/library/scala/Function2.scala
index 7bd2504fa5..f8dff7dc75 100644
--- a/src/library/scala/Function2.scala
+++ b/src/library/scala/Function2.scala
@@ -5,19 +5,15 @@
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
-
-// generated by genprod on Sat Oct 16 11:19:09 PDT 2010 (with fancy comment) (with extra methods)
+// GENERATED CODE: DO NOT EDIT. See scala.Function0 for timestamp.
package scala
-
-
-/** Function with 2 parameters.
+/** A function of 2 parameters.
*
- * In the following example the definition of
- * max is a shorthand for the anonymous class
- * definition anonfun2:
+ * In the following example, the definition of max is a
+ * shorthand for the anonymous class definition anonfun2:
*
* {{{
* object Main extends Application {
@@ -26,17 +22,19 @@ package scala
* val anonfun2 = new Function2[Int, Int, Int] {
* def apply(x: Int, y: Int): Int = if (x < y) y else x
* }
- *
- * println(max(0, 1))
- * println(anonfun2(0, 1))
+ * assert(max(0, 1) == anonfun2(0, 1))
* }
* }}}
*/
trait Function2[@specialized(scala.Int, scala.Long, scala.Double) -T1, @specialized(scala.Int, scala.Long, scala.Double) -T2, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double) +R] extends AnyRef { self =>
- def apply(v1:T1,v2:T2): R
- override def toString() = "<function2>"
+ /** Apply the body of this function to the arguments.
+ * @return the result of function application.
+ */
+ def apply(v1: T1, v2: T2): R
- /** f(x1, x2) == (f.curried)(x1)(x2)
+ /** Creates a curried version of this function.
+ *
+ * @return a function `f` such that `f(x1)(x2) == apply(x1, x2)`
*/
def curried: T1 => T2 => R = {
(x1: T1) => (x2: T2) => apply(x1, x2)
@@ -44,10 +42,13 @@ trait Function2[@specialized(scala.Int, scala.Long, scala.Double) -T1, @speciali
@deprecated("Use 'curried' instead")
def curry = curried
- /* f(x1, x2) == (f.tupled)(Tuple2(x1, x2))
+ /** Creates a tupled version of this function: instead of 2 arguments,
+ * it accepts a single [[scala.Tuple2]] argument.
+ *
+ * @return a function `f` such that `f((x1, x2)) == f(Tuple2(x1, x2)) == apply(x1, x2)`
*/
def tupled: Tuple2[T1, T2] => R = {
case Tuple2(x1, x2) => apply(x1, x2)
}
-
+ override def toString() = "<function2>"
}