summaryrefslogtreecommitdiff
path: root/docs/examples/sort2.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2006-02-22 17:54:31 +0000
committermichelou <michelou@epfl.ch>2006-02-22 17:54:31 +0000
commit96ae92e4f6f830a9a4e55768c3de0328a2a030ba (patch)
tree0b84d247c1693bf186787aaa8f0c75d89fea9be3 /docs/examples/sort2.scala
parentc1e184a3657d970a8fba6e3c7049f20a2e466bf0 (diff)
downloadscala-96ae92e4f6f830a9a4e55768c3de0328a2a030ba.tar.gz
scala-96ae92e4f6f830a9a4e55768c3de0328a2a030ba.tar.bz2
scala-96ae92e4f6f830a9a4e55768c3de0328a2a030ba.zip
adapted code to Scala 2 syntax in files src/exa...
adapted code to Scala 2 syntax in files src/examples/**/*.scala
Diffstat (limited to 'docs/examples/sort2.scala')
-rw-r--r--docs/examples/sort2.scala22
1 files changed, 11 insertions, 11 deletions
diff --git a/docs/examples/sort2.scala b/docs/examples/sort2.scala
index 53b2f89174..1e471b89df 100644
--- a/docs/examples/sort2.scala
+++ b/docs/examples/sort2.scala
@@ -1,4 +1,4 @@
-package examples;
+package examples
object sort2 {
@@ -6,19 +6,19 @@ object sort2 {
if (a.length < 2)
a
else {
- val pivot = a(a.length / 2);
- def lePivot(x: Int) = x < pivot;
- def gtPivot(x: Int) = x > pivot;
- def eqPivot(x: Int) = x == pivot;
- sort(a filter lePivot)
- ::: sort(a filter eqPivot)
- ::: sort(a filter gtPivot)
+ val pivot = a(a.length / 2)
+ def lePivot(x: Int) = x < pivot
+ def gtPivot(x: Int) = x > pivot
+ def eqPivot(x: Int) = x == pivot
+ sort(a filter lePivot) :::
+ sort(a filter eqPivot) :::
+ sort(a filter gtPivot)
}
}
- def main(args: Array[String]) = {
- val xs = List(6, 2, 8, 5, 1);
- Console.println(xs);
+ def main(args: Array[String]): Unit = {
+ val xs = List(6, 2, 8, 5, 1)
+ Console.println(xs)
Console.println(sort(xs))
}