diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2005-12-16 18:44:33 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2005-12-16 18:44:33 +0000 |
commit | 53a3cc7b17f4cf97075b7e71720777fd84109696 (patch) | |
tree | 0cc784e0b47ea49cc151a136d19f20bfa8ee2197 /sources/examples/iterators.scala | |
parent | df50e05006b43b007c2587549030d24b5c154398 (diff) | |
download | scala-53a3cc7b17f4cf97075b7e71720777fd84109696.tar.gz scala-53a3cc7b17f4cf97075b7e71720777fd84109696.tar.bz2 scala-53a3cc7b17f4cf97075b7e71720777fd84109696.zip |
Created proper 'docs' folder for new layout.
Diffstat (limited to 'sources/examples/iterators.scala')
-rw-r--r-- | sources/examples/iterators.scala | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/sources/examples/iterators.scala b/sources/examples/iterators.scala deleted file mode 100644 index 5f951156cf..0000000000 --- a/sources/examples/iterators.scala +++ /dev/null @@ -1,29 +0,0 @@ -package examples; - -object iterators { - - def Array(elems: Double*): Array[Double] = { - val ar = new Array[Double](elems.length); - for (val i <- Iterator.range(0, elems.length)) - ar(i) = elems(i); - ar - } - - def printArray(xs: Array[Double]) = - Iterator.fromArray(xs) foreach { x => Console.println(x) }; - - def findGreater(xs: Array[Double], limit: Double) = - Iterator.fromArray(xs) - .zip(Iterator.from(0)) - .filter{case Pair(x, i) => x > limit } - .map{case Pair(x, i) => i} - - def main(args: Array[String]) = { - val ar = Array/*[Double]*/(6, 2, 8, 5, 1); - printArray(ar); - Console.println("Elements greater than 3.0:"); - findGreater(ar, 3.0) foreach { x => Console.println(ar(x)) } - } - -} - |