Thursday, 19 September 2013

Scala.NotImplementedError: an implementation is missing?

Scala.NotImplementedError: an implementation is missing?

Here is my code:
package example
object Lists {
def max(xs: List[Int]): Int = {
if(xs.isEmpty){
throw new java.util.NoSuchElementException()
}
else {
max(xs.tail)
}
}
}
When i run it in sbt console:
scala> import example.Lists._
scala> max(List(1,3,2))
I have the following error:
Scala.NotImplementedError: an implementation is missing
How can I fix that?
Thanks.

No comments:

Post a Comment