scala-repl

Running scala in cmd makes i look like I am missing 'build.sbt'

我与影子孤独终老i 提交于 2021-02-11 12:53:27
问题 I'm trying to run Scala in my command line. I checked my java, went to the Scala website, downloaded and installed it, updated my environment variables. So far the only thing different from guides online is that the folder where sbt is installed does not include a "lib" folder. I then run sbt command in my prompt, and I get this message: It looks like I'm missing a file called build.sbt , what is this? and do i need it? Edit: If I press 'continue' on the picture above, I get sbt:scalaproj>

val behavior in scala REPL and Intellij

五迷三道 提交于 2021-02-05 08:49:06
问题 as expected reassignment is giving error like below in REPL scala> val a=1 a: Int = 1 scala> a=2 <console>:12: error: reassignment to val a=2 ^ But the below reassignment is not giving error in REPL when a=2 preceded with val. scala> val a=1 a: Int = 1 scala> val a=2 a: Int = 2 When I execute the below code in Intellij its giving error. object Test { def main(args: Array[String]) { val x = 1 val x = 2 } } Why val a=1 and val a=2 are not giving any error in REPL(error if it is only a=2) but

Nested environments in Scala REPL

雨燕双飞 提交于 2019-12-13 01:54:14
问题 Is it possible to create ( enter ) nested environments in Scala REPL, such that after exiting the nested environment, all variable bindings created within the exited environment will be lost? Here is what I wish a session could look like: scala> val x = 1 x: Int = 1 scala> enter // How to implement this? // Entering nested context (type exit to exit) scala> val x = 2 x: Int = 2 scala> val y = 3 y: Int = 3 scala> exit // How to implement this? // Exiting nested context scala> assert(x == 1)

Ubuntu + scala REPL, Commands not typed on console

允我心安 提交于 2019-12-03 14:30:07
问题 I am using Ubuntu 18.04 + Scala 2.11.12 (OpenJDK 64-Bit Server VM, Java 1.8.0_162). Once I open the scala shell, I am not able to see anything that I type. It gets typed though. Below is how it is happening when I type println("Hello, world!") at console: $ scala Welcome to Scala 2.11.12 (OpenJDK 64-Bit Server VM, Java 1.8.0_162). Type in expressions for evaluation. Or try :help. scala> Hello, world! scala> Any ideas on how we can get through? 回答1: To fix the problem in the current scala repl