diff options
author | buraq <buraq@epfl.ch> | 2004-02-11 18:41:57 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2004-02-11 18:41:57 +0000 |
commit | a0ae30f323e2038eef7c3e976aec93eae6e651b9 (patch) | |
tree | 30f1df4f42e3d734e9fe52c868770afb43480317 | |
parent | fb462ea1b336dbb9b6b71f4a835d6f6071ef9611 (diff) | |
download | scala-a0ae30f323e2038eef7c3e976aec93eae6e651b9.tar.gz scala-a0ae30f323e2038eef7c3e976aec93eae6e651b9.tar.bz2 scala-a0ae30f323e2038eef7c3e976aec93eae6e651b9.zip |
> becomes lt, for XML literal support
-rw-r--r-- | sources/scala/List.scala | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/sources/scala/List.scala b/sources/scala/List.scala index efbc84edd3..bf5a699dd6 100644 --- a/sources/scala/List.scala +++ b/sources/scala/List.scala @@ -453,7 +453,7 @@ trait List[+a] extends Seq[a] { * Note: The current implementation is inefficent for * already sorted lists. */ - def sort(< : (a,a) => Boolean): List[a] = { + def sort(lt : (a,a) => Boolean): List[a] = { def sort_1(smaller: List[a], acc: List[a]): List[a] = smaller.match { case Nil => @@ -461,18 +461,18 @@ trait List[+a] extends Seq[a] { case List(x) => x::acc case List(x, y) => - if (<(x, y)) x::(y::acc) else y::x::acc + if (lt(x, y)) x::(y::acc) else y::x::acc case List(x, y, z) => - if (<(x, y)) { - if (<(y, z)) x::y::z::acc - else if (<(x, z)) x::z::y::acc + if (lt(x, y)) { + if (lt(y, z)) x::y::z::acc + else if (lt(x, z)) x::z::y::acc else z::x::y::acc - } else if (<(x, z)) y::x::z::acc - else if (<(z, y)) z::y::x::acc + } else if (lt(x, z)) y::x::z::acc + else if (lt(z, y)) z::y::x::acc else y::z::x::acc case hd1::hd2::hd3::tail => { val List(x, y, z) = sort_1(hd1::hd2::hd3::Nil, Nil); - val Pair(small, large) = tail.partition((e2) => <(e2, y)); + val Pair(small, large) = tail.partition((e2) => lt(e2, y)); sort_1(x::small, y::sort_1(z::large, acc)) } } @@ -483,18 +483,18 @@ trait List[+a] extends Seq[a] { case List(x) => this case List(x, y) => - if (<(x, y)) this else y::x::Nil + if (lt(x, y)) this else y::x::Nil case List(x, y, z) => - if (<(x, y)) { - if (<(y, z)) this - else if (<(x, z)) x::z::y::Nil + if (lt(x, y)) { + if (lt(y, z)) this + else if (lt(x, z)) x::z::y::Nil else z::x::y::Nil - } else if (<(x, z)) y::x::z::Nil - else if (<(z, y)) z::y::x::Nil + } else if (lt(x, z)) y::x::z::Nil + else if (lt(z, y)) z::y::x::Nil else y::z::x::Nil case hd1::hd2::hd3::tail => { val List(x, y, z) = sort_1(hd1::hd2::hd3::Nil, Nil); - val Pair(small,large) = tail.partition((e2) => <(e2, y)); + val Pair(small,large) = tail.partition((e2) => lt(e2, y)); sort_1(x::small, y::sort_1(z::large, Nil)); } } |