5

When I add this class to a scala worksheet I receive the error :

';' expected but 'import' found.

object polynomials {

    class Poly(val terms: Map[Int , Double]) {
        def + (other: Poly) = new Poly(terms ++ other.terms)
    }

    val p1 = new Poly(Map(1 -> 2.0, 3 -> 4.0, 5 -> 6.2))

}

The class looks fine to me, is there something missing ?

user701254
  • 3,935
  • 7
  • 42
  • 53

1 Answers1

9

This was a bug. A new version of the Worksheet was released a few days ago that fixes it, so go to Help > Check for updates, and the new version should be available for installation. I tried your code on Worksheet 0.1.2.v-2_09-201210230838-85b738a and it's fine.

Luigi Plinge
  • 50,650
  • 20
  • 113
  • 180