summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2008-02-19 17:56:36 +0000
committermichelou <michelou@epfl.ch>2008-02-19 17:56:36 +0000
commitc1f27b70c6204f1fde94a49426e05ef19315b460 (patch)
tree5730a2097c1eeb698c7cd34a246cdb541959a3c4 /src
parent7231cf881a4557d26d4356ad534fb9a0713214a6 (diff)
downloadscala-c1f27b70c6204f1fde94a49426e05ef19315b460.tar.gz
scala-c1f27b70c6204f1fde94a49426e05ef19315b460.tar.bz2
scala-c1f27b70c6204f1fde94a49426e05ef19315b460.zip
anonfuns now accept up to 22 args
Diffstat (limited to 'src')
-rw-r--r--src/build/genprod.scala46
-rw-r--r--src/library/scala/Function10.scala26
-rw-r--r--src/library/scala/Function11.scala26
-rw-r--r--src/library/scala/Function12.scala26
-rw-r--r--src/library/scala/Function13.scala26
-rw-r--r--src/library/scala/Function14.scala26
-rw-r--r--src/library/scala/Function15.scala26
-rw-r--r--src/library/scala/Function16.scala26
-rw-r--r--src/library/scala/Function17.scala26
-rw-r--r--src/library/scala/Function18.scala26
-rw-r--r--src/library/scala/Function19.scala26
-rw-r--r--src/library/scala/Function20.scala26
-rw-r--r--src/library/scala/Function21.scala26
-rw-r--r--src/library/scala/Function22.scala26
14 files changed, 359 insertions, 25 deletions
diff --git a/src/build/genprod.scala b/src/build/genprod.scala
index 0fd71ab95d..f7643e9968 100644
--- a/src/build/genprod.scala
+++ b/src/build/genprod.scala
@@ -17,16 +17,15 @@
* where <code>PATH</code> is the desired output directory
* </p>
*
- * @author Burak Emir
- * @version 1.0
+ * @author Burak Emir, Stephane Micheloud
+ * @version 1.1
*/
object genprod {
/** The biggest ?? has Sup?? - 1 components/arguments */
val SUP_PRODUCT_ARITY = 23
val SUP_TUPLE_ARITY = 23
- val SUP_FUNCTION_ARITY = 9
- val SUP_CHOICE_ARITY = 9 // not implemented yet
+ val SUP_FUNCTION_ARITY = 23
def productClassname(i: Int) = "Product"+i
@@ -59,9 +58,8 @@ object genprod {
def mdefs(i: Int) =
for (j <- List.range(1, i+1)) yield "_" + j
-
- def zippedAndCommaSeparated (left: List[String], right: List[String]): String = {
- val sb = new StringBuffer()
+ def zippedAndCommaSeparated(left: List[String], right: List[String]): String = {
+ val sb = new StringBuilder
val it = (left zip right).elements
def append1 = {
val p = it.next
@@ -87,16 +85,13 @@ object genprod {
def functionFiles =
for (i <- List.range(0, SUP_FUNCTION_ARITY)) yield FunctionFile.make(i)
- //def choiceFiles =
- // for (i <- List.range(2, SUP_CHOICE_ARITY)) yield ChoiceFile.make(i)
-
def allfiles =
productFiles ::: tupleFiles ::: functionFiles
- def main(args:Array[String]) = {
+ def main(args: Array[String]) {
if (args.length != 1) {
- Console.println("please give path of output directory")
- System.exit(-1)
+ println("please give path of output directory")
+ exit(-1)
}
import java.io.{File, FileOutputStream}
import java.nio.channels.Channels
@@ -112,8 +107,8 @@ object genprod {
w.close
} catch {
case e: java.io.IOException =>
- Console.println(e.getMessage() + ": " + out)
- System.exit(-1)
+ println(e.getMessage() + ": " + out)
+ exit(-1)
}
}
}
@@ -131,7 +126,7 @@ object FunctionFile {
<file name={functionFilename(i)}>
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -184,8 +179,8 @@ trait {functionClassname(i)}{__typeArgs__} extends AnyRef {{
* <b>def</b> apply(): Long = System.currentTimeMillis() / 1000L
* }
*
- * Console.println(currentSeconds())
- * Console.println(anonfun0())
+ * println(currentSeconds())
+ * println(anonfun0())
* }</pre>"""
case 1 => """<p>
In the following example the definition of
@@ -201,8 +196,8 @@ trait {functionClassname(i)}{__typeArgs__} extends AnyRef {{
* <b>def</b> apply(x: Int): Int = x + 1
* }
*
- * Console.println(succ(0))
- * Console.println(anonfun1(0))
+ * println(succ(0))
+ * println(anonfun1(0))
* }</pre>"""
case 2 => """<p>
In the following example the definition of
@@ -218,8 +213,8 @@ trait {functionClassname(i)}{__typeArgs__} extends AnyRef {{
* <b>def</b> apply(x: Int, y: Int): Int = <b>if</b> (x < y) y <b>else</b> x
* }
*
- * Console.println(max(0, 1))
- * Console.println(anonfun2(0, 1))
+ * println(max(0, 1))
+ * println(anonfun2(0, 1))
* }</pre>"""
case _ => ""
}
@@ -259,7 +254,7 @@ case class {tupleClassname(i)}{__typeArgs__}({ __fields__ })
{ if ({i} == 1)
"sb.append('(').append(_" + {i} + ").append(\",)\")"
else {
- val xs = List.range(1, i+1).map(i => ".append(_" + i + ")")
+ val xs = (1 to i).map(i => ".append(_" + i + ")")
xs.mkString("sb.append('(')", ".append(',')",".append(')')")
}
}
@@ -321,12 +316,13 @@ trait {productClassname(i)}{__typeArgs__} extends Product {{
* @return same as _(n+1)
* @throws IndexOutOfBoundsException
*/
+ @throws(classOf[IndexOutOfBoundsException])
override def productElement(n: Int) = n match {{
- {for (Tuple2(m, j) <- mdefs(i).zip(List.range(0, i)))
+ {for ((m, j) <- mdefs(i).zip(List.range(0, i)))
yield "case "+j+" => "+m+"\n "}case _ => throw new IndexOutOfBoundsException(n.toString())
}}
- {for (Tuple2(m, t) <- mdefs(i) zip targs(i)) yield
+ {for ((m, t) <- mdefs(i) zip targs(i)) yield
"/** projection of this product */\n def " + m + ": " + t + "\n\n" }
}}
</file>
diff --git a/src/library/scala/Function10.scala b/src/library/scala/Function10.scala
new file mode 100644
index 0000000000..ade34675c4
--- /dev/null
+++ b/src/library/scala/Function10.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 10 parameters.
+ * </p>
+ *
+ */
+trait Function10[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function11.scala b/src/library/scala/Function11.scala
new file mode 100644
index 0000000000..b9dd8b3f88
--- /dev/null
+++ b/src/library/scala/Function11.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 11 parameters.
+ * </p>
+ *
+ */
+trait Function11[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function12.scala b/src/library/scala/Function12.scala
new file mode 100644
index 0000000000..f2af9f9ef2
--- /dev/null
+++ b/src/library/scala/Function12.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 12 parameters.
+ * </p>
+ *
+ */
+trait Function12[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11, v12:T12): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function13.scala b/src/library/scala/Function13.scala
new file mode 100644
index 0000000000..89de7e4bc1
--- /dev/null
+++ b/src/library/scala/Function13.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 13 parameters.
+ * </p>
+ *
+ */
+trait Function13[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11, v12:T12, v13:T13): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function14.scala b/src/library/scala/Function14.scala
new file mode 100644
index 0000000000..acfa750183
--- /dev/null
+++ b/src/library/scala/Function14.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 14 parameters.
+ * </p>
+ *
+ */
+trait Function14[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11, v12:T12, v13:T13, v14:T14): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function15.scala b/src/library/scala/Function15.scala
new file mode 100644
index 0000000000..4b1daed906
--- /dev/null
+++ b/src/library/scala/Function15.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 15 parameters.
+ * </p>
+ *
+ */
+trait Function15[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11, v12:T12, v13:T13, v14:T14, v15:T15): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function16.scala b/src/library/scala/Function16.scala
new file mode 100644
index 0000000000..e09499c767
--- /dev/null
+++ b/src/library/scala/Function16.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 16 parameters.
+ * </p>
+ *
+ */
+trait Function16[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11, v12:T12, v13:T13, v14:T14, v15:T15, v16:T16): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function17.scala b/src/library/scala/Function17.scala
new file mode 100644
index 0000000000..83f9230024
--- /dev/null
+++ b/src/library/scala/Function17.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 17 parameters.
+ * </p>
+ *
+ */
+trait Function17[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11, v12:T12, v13:T13, v14:T14, v15:T15, v16:T16, v17:T17): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function18.scala b/src/library/scala/Function18.scala
new file mode 100644
index 0000000000..6b798ed132
--- /dev/null
+++ b/src/library/scala/Function18.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 18 parameters.
+ * </p>
+ *
+ */
+trait Function18[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11, v12:T12, v13:T13, v14:T14, v15:T15, v16:T16, v17:T17, v18:T18): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function19.scala b/src/library/scala/Function19.scala
new file mode 100644
index 0000000000..c3b27cc297
--- /dev/null
+++ b/src/library/scala/Function19.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 19 parameters.
+ * </p>
+ *
+ */
+trait Function19[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11, v12:T12, v13:T13, v14:T14, v15:T15, v16:T16, v17:T17, v18:T18, v19:T19): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function20.scala b/src/library/scala/Function20.scala
new file mode 100644
index 0000000000..175c50edf1
--- /dev/null
+++ b/src/library/scala/Function20.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 20 parameters.
+ * </p>
+ *
+ */
+trait Function20[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11, v12:T12, v13:T13, v14:T14, v15:T15, v16:T16, v17:T17, v18:T18, v19:T19, v20:T20): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function21.scala b/src/library/scala/Function21.scala
new file mode 100644
index 0000000000..5825699025
--- /dev/null
+++ b/src/library/scala/Function21.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 21 parameters.
+ * </p>
+ *
+ */
+trait Function21[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, -T21, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11, v12:T12, v13:T13, v14:T14, v15:T15, v16:T16, v17:T17, v18:T18, v19:T19, v20:T20, v21:T21): R
+ override def toString() = "<function>"
+
+}
diff --git a/src/library/scala/Function22.scala b/src/library/scala/Function22.scala
new file mode 100644
index 0000000000..1dc29a0e81
--- /dev/null
+++ b/src/library/scala/Function22.scala
@@ -0,0 +1,26 @@
+
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: genprod.scala 13898 2008-02-06 10:43:23Z michelou $
+
+// generated by genprod on Tue Feb 19 17:26:58 CET 2008
+
+package scala
+
+
+/** <p>
+ * Function with 22 parameters.
+ * </p>
+ *
+ */
+trait Function22[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, -T21, -T22, +R] extends AnyRef {
+ def apply(v1:T1, v2:T2, v3:T3, v4:T4, v5:T5, v6:T6, v7:T7, v8:T8, v9:T9, v10:T10, v11:T11, v12:T12, v13:T13, v14:T14, v15:T15, v16:T16, v17:T17, v18:T18, v19:T19, v20:T20, v21:T21, v22:T22): R
+ override def toString() = "<function>"
+
+}