Scala.NotImplementedError: an implementation is missing?

I had the same problem because I did not quit the Scala console (in IntelliJ) from sbt with the command:

scala> :q

and then restarted the the console from sbt, so that everything could be compiled again.

> console

It`s not necessary to restart sbt, though.


open example.Lists, you will see below lines:

def sum(xs: List[Int]): Int = ???
def max(xs: List[Int]): Int = ???

use 0 instead of ???.


Also, putting the correct recursive implementation for the max that should work

  def max(xs: List[Int]): Int = {
    if(xs.isEmpty){
      throw new java.util.NoSuchElementException()
    }
    val tailMax =  if (xs.tail.isEmpty)  xs.head else max(xs.tail)
    if (xs.head >= tailMax){
      xs.head
    }
    else  tailMax;
  }

I have suffered the same problem. But I have fixed it.

The solution is that you should restart your "sbt console", and import the module again, it works fine.

Tags:

Scala