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/sort2.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/sort2.scala')
-rw-r--r-- | sources/examples/sort2.scala | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/sources/examples/sort2.scala b/sources/examples/sort2.scala deleted file mode 100644 index 53b2f89174..0000000000 --- a/sources/examples/sort2.scala +++ /dev/null @@ -1,25 +0,0 @@ -package examples; - -object sort2 { - - def sort(a: List[Int]): List[Int] = { - 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) - } - } - - def main(args: Array[String]) = { - val xs = List(6, 2, 8, 5, 1); - Console.println(xs); - Console.println(sort(xs)) - } - -} |