I'm learning Scala, and I was attempting to import from 2 scrips in different classes, but, I get an error, and I don't know why.
This class, in Summer.scala, is where I try to import the singleton object from class ChecksumAccumulator.
import ChecksumAccumulator.calculate
object Summer{
  def main(args: Array[String]): Unit= {
    for (arg <- args)
      println(arg + " : " +  calculate(arg))
  }
}
Class ChecksumAccumulator, with the singleton object ChecksumAccumulator.
object ChecksumAccumulator {
/*
 When a singleton object shares the same name
 with a class, it is called that class's companion object. 
*/
  private val cache = mutable.Map.empty[String, Int]
  def calculate(s: String): Int =
    if (cache.contains(s))
      cache(s)
    else {
      val acc = new ChecksumAccumulator
      //The object with the same name of the class can acces to the private members.
      //println(acc.sum)
      for (c <- s)
        acc.add(c.toByte)
      val cs = acc.checksum()
      cache += (s -> cs)
      cs
    }
    def showMap() : Unit = {
      for(base:String <- cache.keys)
        println(cache(base))
    }
//def showMap(): String = { var cadena = cache("Every value is an object.") +  " "+ cache("Every value is an object. per second time!!");  cadena  }
}
This script throw this mistake
scala Summer.scala
Summer.scala:8: error: not found: object ChecksumAccumulator import ChecksumAccumulator.calculate ^ Summer.scala:14: error: not found: value calculate println(arg + " : " + calculate(arg)) ^ two errors found
 
     
    