diff options
author | paltherr <paltherr@epfl.ch> | 2004-01-08 18:39:04 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2004-01-08 18:39:04 +0000 |
commit | 5e749cea9d9d46d98c9150d43f67fc9de6f3810a (patch) | |
tree | aa46cd0389ece34de7b3920853a772b0094ef130 /sources | |
parent | 084de2477e8e47b53322721e9682b8107609bbe9 (diff) | |
download | scala-5e749cea9d9d46d98c9150d43f67fc9de6f3810a.tar.gz scala-5e749cea9d9d46d98c9150d43f67fc9de6f3810a.tar.bz2 scala-5e749cea9d9d46d98c9150d43f67fc9de6f3810a.zip |
- Added method Array
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/Predef.scala | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sources/scala/Predef.scala b/sources/scala/Predef.scala index c3c74c7bef..e24829312e 100644 --- a/sources/scala/Predef.scala +++ b/sources/scala/Predef.scala @@ -26,7 +26,24 @@ object Predef { type boolean = scala.Boolean; type unit = scala.Unit; - def List[A](x: A*): List[A] = x.asInstanceOf[List[A]]; + /** Create an array with given elements. + * + * @param xs the elements to put in the array + * @return the array containing elements xs. + */ + def Array[A](xs: A*): Array[A] = { + val array: Array[A] = new Array[A](xs.length); + var i = 0; + for (val x <- xs.elements) { array(i) = x; i = i + 1; } + array; + } + + /** Create a list with given elements. + * + * @param xs the elements to put in the list + * @return the list containing elements xs. + */ + def List[A](xs: A*): List[A] = xs.asInstanceOf[List[A]]; val List = scala.List; def error(message: String): All = throw new Error(message); |