read-eval-print-loop

C# Console/CLI Interpreter?

≯℡__Kan透↙ 提交于 2019-12-18 10:40:24
问题 I wonder if there is something like a standalone Version of Visual Studios "Immediate Window"? Sometimes I just want to test some simple stuff, like "DateTime.Parse("blah")" to see if that works. But everytime i have to create a new console application, put in my code and test it. The Immediate Window sadly only works when I am debugging something. Could PowerShell do that? Just open a CLI similar to what cmd.exe does, allowing me to execute some C# code? 回答1: Linqpad - I use it like this all

Scala REPL startup error “class file is broken” [duplicate]

[亡魂溺海] 提交于 2019-12-18 03:05:48
问题 This question already has answers here : Scala repl throws error (4 answers) Closed 5 years ago . Every time after starting Scala 2.9.2 REPL (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0-ea) first line of code executing bring me an error: scala> 1 + 2 error: error while loading CharSequence, class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar(java/lang/CharSequence.class)' is broken (bad constant pool tag 15 at byte 1484) Later during further evaluation in current REPL instance no similar

Prevent Node.js repl from printing output

拈花ヽ惹草 提交于 2019-12-17 19:38:08
问题 If the result of some javascript calculation is an array of 10,000 elements, the Node.js repl prints this out. How do I prevent it from doing so? Thanks 回答1: Why don't you just append ; null; to your expression? As in new Array(10000); null; which prints null or even shorter, use ;0; 回答2: Assign the result to a variable declared with var . var statements always return undefined . > new Array(10) [ , , , , , , , , , ] > var a = new Array(10) undefined 回答3: Node uses inspect to format the

Vim: Run selected code in a persistent REPL-environment

回眸只為那壹抹淺笑 提交于 2019-12-17 18:41:09
问题 R, Python, Scala etc. all come with REPL-environments, which I don't want to miss, however, most of the time editing text in them sucks, so I edit the code in vim, paste it and look at the output and edit the code in vim again. I can run the current file with !python % and I can run the current line with even more vim magic, however, this will start a new process of the interpreter. Is it possible to start a REPL and send lines of code to the running REPL (and get the results back, obviously)

Change in Xcode 10 Playgrounds Variable Initialization change? Are Xcode 10 Playgrounds an interpreter?

别来无恙 提交于 2019-12-17 16:49:57
问题 I've noticed that Playgrounds in Xcode 10 no longer allow for the use of declared, but uninitialized variables. For example: while this code would work in an Xcode 9 playground, in an Xcode 10 playground (at least in Beta 1), it crashes: var myValue: Int //... myValue = 100 print (myValue) // Xcode 9 prints 100 // Xcode 10 reports an error: variables currently must have an initial value when entered at the top level of the REPL Is this the new behavior, or just a bug in the current Xcode 10

Why is it possible to declare variable with same name in the REPL?

≡放荡痞女 提交于 2019-12-17 07:38:16
问题 scala> val hi = "Hello \"e" hi: String = Hello "e scala> val hi = "go" hi: String = go Within same REPL session why its allowing me to declare variable hi with same name ? scala> hi res1: String = go scala> hi="new" <console>:8: error: reassignment to val hi="new" ^ This error i understood we cannot reassign val 回答1: The interesting design feature of the REPL is that your two definitions are translated to: object A { val greeting = "hi" } object B { val greeting = "bye" } A subsequent usage

Spark Windows Installation Java Error

女生的网名这么多〃 提交于 2019-12-14 04:17:10
问题 I am continuing a question from this previous question - winutils spark windows installation - and I am aware of this thread - How to start Spark applications on Windows (aka Why Spark fails with NullPointerException)? -, but I haven't found anything that fixes my problem yet. I am also aware that it has been recommended to build spark from source code with maven or sbt. I do not want to do that yet, as lot's of people do not build spark from source and it works fine for them. So far I have

How does the scala REPL work when defining a class?

守給你的承諾、 提交于 2019-12-13 17:22:07
问题 If I open the Scala REPL, I noticed I can create classes. My questions are: What does the REPL do when there is a class definition? Does it compile the class? 回答1: The REPL is not an interpreter in the usual sense, as it never executes code directly. Code that you enter in the REPL is always compiled and so are class definitions. 来源: https://stackoverflow.com/questions/12712254/how-does-the-scala-repl-work-when-defining-a-class

Custom Scala REPL Issues

ⅰ亾dé卋堺 提交于 2019-12-13 16:15:05
问题 I'm trying to write a basic Scala REPL using some information I found on various sites. My most basic REPL implementation looks like this, import scala.tools.nsc.Settings import scala.tools.nsc.interpreter._ object BillyREPL extends App { val settings = new Settings settings.usejavacp.value = true settings.deprecation.value = true new ILoop().process(settings) } With the following build settings, import sbt._ import sbt.Keys._ object BillyREPLBuild extends Build { lazy val billyrepl = Project

Code compiles with scalac but not in REPL

白昼怎懂夜的黑 提交于 2019-12-13 04:45:40
问题 I have some code, say in Foo.scala that compiles readily with scalac , but I get a blizzard of errors when I boot up the REPL and say :load Foo.scala . I imagine this is standard and documented but can't seem to find any relevant information about it. The file looks like this: abstract class BST[A](implicit cmp: A => Ordered[A]) { def fold[B](f: (B, A) => B, acc: B): B = { this match { case Leaf() => acc } } } case class Leaf[A]()(implicit cmp: A => Ordered[A]) extends BST[A] And I get errors