read-eval-print-loop

Is it possible to build a interactive C shell?

℡╲_俬逩灬. 提交于 2019-12-03 05:51:41
问题 I'm just wondering if this is possible using either (Python, Java or C)? I'm looking for something like IPython for Python. 回答1: Yes, and such things already exist, you just have to google for them :-) Ch is one popular example CINT is another That said, actually developing a functional interpreter like this from scratch is much more difficult than finding one online. So now it depends on what's behind your question - do you want just an interpreter to use? Then pick one of the linked above.

How to make sbt `console` use -Yrepl-sync?

£可爱£侵袭症+ 提交于 2019-12-03 05:43:48
New in Scala 2.9.1 is the -Yrepl-sync option, which prevents each REPL line from being run in a new thread: scala -Yrepl-sync When I run console from sbt, how do I have it pass this in? Short answer: set scalacOptions in (Compile, console) += "-Yrepl-sync" How to discover this: ~/code/scratch/20110930 sbt [info] Loading global plugins from /Users/jason/.sbt11/plugins [info] Set current project to default-9c7c16 (in build file:/Users/jason/code/scratch/20110930/) > inspect console [info] Task: Unit [info] Description: [info] Starts the Scala interpreter with the project classes on the classpath

Clear terminal window in Node.js readline shell

主宰稳场 提交于 2019-12-03 04:22:37
问题 I have a simple readline shell written in Coffeescript: rl = require 'readline' cli = rl.createInterface process.stdin, process.stdout, null cli.setPrompt "hello> " cli.on 'line', (line) -> console.log line cli.prompt() cli.prompt() Running this displays a prompt: $ coffee cli.coffee hello> I would like to be able to hit Ctrl-L to clear the screen. Is this possible? I have also noticed that I cannot hit Ctrl-L in either the node or coffee REPLs either. I am running on Ubuntu 11.04. 回答1: You

mit-scheme REPL with command line history and tab completion

妖精的绣舞 提交于 2019-12-03 03:59:09
问题 I'm reading SICP and I'm using mit-scheme installed on my os x 10.8 laptop via homebrew. Everything works as advertised, however I'm spoiled by the ease with which I get tab completion and command line history in REPL's for runtimes like Python and Node.js. I'm not looking for anything heavy duty, but these features are pretty easy to come by in modern REPL's (it's just a simple startup file in Python and can be implemented in a few lines in Node.js). Is there an easy way to get tab

How to clear the REPL in cider-mode?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 03:53:23
I am not meaning cleaning up the text output of REPL; I mean cleaning up all evaluated results in REPL. During developing, repeatedly C-c C-q and C-c M-j is low efficiency. UPDATE There may be some bad debug behaviour of mine. I am not sure how other people develop progs with CIDER, but I really need the functionality mentioned above. I guess other developers also encounter same problems as mine. For example, at the top of a clojure prog unit, I use declare to declare a function foo , which is used by another function bar , and foo is implemented after bar . Then, I C-c C-k , etc, and the prog

How is Lisp's read-eval-print loop different than Python's?

删除回忆录丶 提交于 2019-12-03 03:50:49
问题 I've encounter a following statement by Richard Stallman: 'When you start a Lisp system, it enters a read-eval-print loop. Most other languages have nothing comparable to read, nothing comparable to eval, and nothing comparable to print. What gaping deficiencies! ' Now, I did very little programming in Lisp, but I've wrote considerable amount of code in Python and recently a little in Erlang. My impression was that these languages also offer read-eval-print loop, but Stallman disagrees (at

Scala - Initialize REPL environment

亡梦爱人 提交于 2019-12-03 03:30:26
-Hi. I'd like to embed Scala REPL with initialized environment into my app. I've looked at IMain class and it seems I could do it via instance of it. The instance is created and then stored into intp public var in process() of ILoop . How can I bind some names and/or add some imports before process() (e.g. before REPL)? Following code fails on line 3 because intp is not yet created (=> NPE): val x = 3 val interp = new ILoop interp.bind("x", x) // -> interp.intp.bind("x", x) val settings = new Settings settings.usejavacp.value = true interp.process(settings) Thank you-. UPDATE: Overriding

Embedded Scala REPL Interpreter example for 2.10

China☆狼群 提交于 2019-12-02 22:42:34
Please give a code example of how to create an embedded Scala REPL interpreter programmatically, that works in Scala 2.10. (I added this Q&A after spending hours combing various code scraps to get a working interpreter) Example Repl.scala : import scala.tools.nsc.interpreter._ import scala.tools.nsc.Settings object Repl extends App { def repl = new ILoop { override def loop(): Unit = { intp.bind("e", "Double", 2.71828) super.loop() } } val settings = new Settings settings.Yreplsync.value = true //use when launching normally outside SBT settings.usejavacp.value = true //an alternative to

Clojure Development: IDE or REPL?

对着背影说爱祢 提交于 2019-12-02 20:38:38
I've been using Clojure for a little while and want to create some projects that are bigger and more complicated than toys. I've been using Java for the past few years and have become accustomed to what IDEs do for me -- compile lots of classes, package them up in jars, create batch files for users to start them with. When I look at examples of development in Clojure they seem to be along the lines of load files into the REPL, see how they work, edit the file, reload, repeat. Nary a class or jar being generated anywhere. In Stuart Halloway's terrific "Programming Clojure" I couldn't find a

settings.maxPrintString for Scala 2.9 REPL

老子叫甜甜 提交于 2019-12-02 19:20:21
I'd like to disable truncation of string values in the Scala REPL. The following thread suggested typing settings.maxPrintString = 0 : How to force interpreter show complete stack trace? Unfortunately, this doesn't seem to work with Scala 2.9: Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_29). Type in expressions to have them evaluated. Type :help for more information. scala> settings.maxPrintString = 0 <console>:10: error: not found: value settings val $ires0 = settings.maxPrintString ^ <console>:7: error: not found: value settings settings.maxPrintString