*** empty log message ***
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@1549 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
0d72fec682
commit
02f3a94c80
|
@ -0,0 +1,18 @@
|
|||
|
||||
object Main {
|
||||
|
||||
def min0[A](less: (A, A) => Boolean, xs: List[A]): Option[A] = xs match {
|
||||
case List() => None
|
||||
case List(x) => Some(x)
|
||||
// case x :: Nil => Some(x)
|
||||
case y :: ys => min0(less, ys) match {
|
||||
case Some(m) => if (less(y, m)) Some(y) else Some(m)
|
||||
}
|
||||
}
|
||||
|
||||
def min(xs: List[Int]) = min0((x: Int, y: Int) => x < y, xs);
|
||||
|
||||
def main(args: Array[String]) =
|
||||
System.out.println(min(List()));
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
object V with Executable {
|
||||
def foo[A](x: String) = new Object;
|
||||
def foo[A](x: Runnable) = new Object;
|
||||
val code = foo[Int]("test");
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
object Main {
|
||||
|
||||
def min0[A](less: (A, A) => Boolean, xs: List[A]): Option[A] = xs match {
|
||||
case List() => None
|
||||
case List(x) => Some(x)
|
||||
// case x :: Nil => Some(x)
|
||||
case y :: ys => min0(less, ys) match {
|
||||
case Some(m) => if (less(y, m)) Some(y) else Some(m)
|
||||
}
|
||||
}
|
||||
|
||||
def min(xs: List[Int]) = min0((x: Int, y: Int) => x < y, xs);
|
||||
|
||||
def main(args: Array[String]) =
|
||||
System.out.println(min(List()));
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
object V with Executable {
|
||||
def foo[A](x: String) = new Object;
|
||||
def foo[A](x: Runnable) = new Object;
|
||||
val code = foo[Int]("test");
|
||||
}
|
Loading…
Reference in New Issue