יום רביעי, 16 בדצמבר 2015

a talk with Scala REPL

THIS IS A TRUE STORY...
At the request of the survivors,
the names have been changed.
Out of respect for the dead,
the rest has been told exactly
as it occurred


me> 1 to
scala> error: ambiguous reference to overloaded definition,
both method to in class RichInt of type (end: Int, step: Int)scala.collection.immutable.Range.Inclusive
and  method to in class RichInt of type (end: Int)scala.collection.immutable.Range.Inclusive
match expected type ?
       1 to
         ^
me>ah... 1 to 10

...

me> (1 to 10) map _ * 2
scala> error: missing parameter type for expanded function ((x$1) => 1.to(10).map(x$1.$times(2)))
       (1 to 10) map _ * 2
                     ^
me> ah, ok, just a missing curly brackets: (1 to 10) map {_ * 2}

..

me> val a: (Int, Int) = 5,5
scala>:1: error: ';' expected but ',' found.
val a: (Int, Int) = 5,5
                     ^
me> ah, ok, just a missing brackets: val a: (Int, Int) = (5,5)

...

To be continued...