read-eval-print-loop

How can I start an interactive console for Perl?

风流意气都作罢 提交于 2019-11-28 02:38:46
How can I start an interactive console for Perl, similar to the irb command for Ruby or python for Python? You can use the perl debugger on a trivial program, like so: perl -de1 Alternatively there's Alexis Sukrieh 's Perl Console application, but I haven't used it. Not only did Matt Trout write an article about a REPL, he actually wrote one - Devel::REPL I've used it a bit and it works fairly well, and it's under active development. BTW, I have no idea why someone modded down the person who mentioned using "perl -e" from the console. This isn't really a REPL, true, but it's fantastically

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

梦想与她 提交于 2019-11-28 01:25:48
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 beta? I had been referring to earlier Xcode Playgrounds as an interpreter, but would one still consider

How do I start the REPL in a user defined namespace?

穿精又带淫゛_ 提交于 2019-11-28 00:55:20
Writing (in-ns 'dbx) to a file and loading it isn't changing the default namespace of the repl (using cygwin/console). The namespace is still user=> , not dbx=> . vikrant[28] clj Clojure 1.3.0 user=> (load-file "try1.clj") #(Namespace dbx) user=> How can we start the REPL in a namespace defined in a script file? BLUEPIXY java -cp .;clojure-1.3.0.jar; clojure.main -e \ "(ns dbx) (clojure.main/repl) (in-ns 'dbx) (clojure.core/use 'clojure.core)" Nowadays is :repl-options {:init-ns foo.bar} . See https://github.com/technomancy/leiningen/blob/master/sample.project.clj Abimaran Kugathasan If you

Is there something like python's interactive REPL mode, but for Java?

陌路散爱 提交于 2019-11-27 23:25:52
Is there something like python's interactive REPL mode, but for Java? So that I can, for example, type InetAddress.getAllByName( localHostName ) in a window, and immediately get results, without all this public static void nightmare() thing? edit Since Java 9 there's JShell Original answer follows You can also use Groovy Console . It is an interactive console where you can do what you want. Since Groovy also includes classes from the core java platform, you'll be able to use those classes as well. It looks like this: Eclipse has a feature to do this, although it's not a loop. It's called a

Swift REPL: how to import, load, evaluate, or require a .swift file?

守給你的承諾、 提交于 2019-11-27 21:54:36
In the Swift REPL, how to import (a.k.a. load, evaluate, require) a typical text *.swift file? I want to use the code from this file: ~/src/Foo.swift Syntax like this doesn't work: import ~/src/Foo.swift For comparison: An equivalent solution in the Swift REPL for a framework is: import Foundation An equivalent solution in the Ruby REPL for a *.ruby file is: require "~/src/foo" These are similar questions that are /not/ what I'm asking: How to use/make a Swift command-line script, executable, module, etc. How to use/make an XCode playground, project, library, framework, etc. How to launch the

Using Node.js with JS-comint in Emacs

帅比萌擦擦* 提交于 2019-11-27 21:23:29
I use Emacs 24.2. I've installed js-comint and js-mode from MELPA , executed run-js , and now in REPL instead of > sign i have this gibberish: ^[[1G> ^[[0K^[[3G The REPL itself in Inferior Javascript mode works just fine, just the > sign is changed. If you enter unfinished expression, it even prints ^[[1G... ^[[0K^[[5G . The ^[ are system characters, that are not copied with copy-paste, i add them for you to have an idea. In my init-file: (require 'js-comint) (setq inferior-js-program-command "nodejs") In terminal calling nodejs produces working REPL. Why prompt behaves this way? What should i

Can you program without REPL on Lisp?

我的未来我决定 提交于 2019-11-27 19:35:03
问题 So I just got Land of Lisp and started to do the first program. I have a couple questions. Is there a way to just write some code and run it through a compiler, or interpreter, and not use the REPL thing? I don't like it much. I can't seem to go back if I messed up. It just kinda says "Ha you screwed up, retype that whole function." I would also like to know what the point of REPL is. 回答1: Non-REPL work flow Edit your file Compile the file using compile-file; fix errors and warnings; repeat.

Import multiple packages in Scala REPL

房东的猫 提交于 2019-11-27 18:08:54
问题 In Scala, I frequently have to import multiple packages worth of implicits and other utilities, particularly on the REPL: import scala.collection.JavaConversions._ import scala.collection.{mutable => mut} import com.myapp.db._ import com.orm._ val con = connectDb(...) ... I understand there's no way to import multiple packages in Scala (though package object scopes can help a bit), but what about from the REPL? Is there any way to do this from the REPL without lots of copying and pasting? I

What command opens Ruby's REPL?

自作多情 提交于 2019-11-27 17:19:09
问题 What command opens Ruby's REPL? In Python, you simply open python without any arguments. 回答1: There are several REPLs for Ruby. The standard library ships with a REPL called IRb (for Interactive Ruby ), which installs a program named irb , but since it is just a Ruby library, it can also be invoked from Ruby code and not just from the shell. On Rubinius, IRb can also be invoked by just calling the rbx program without arguments, just like in CPython. There is also a very nice REPL called Pry,

How to reload a clojure file in REPL

血红的双手。 提交于 2019-11-27 16:38:00
What is the preferred way of reloading functions defined in a Clojure file without having to restart the REPL. Right now, in order to use the updated file I have to: edit src/foo/bar.clj close the REPL open the REPL (load-file "src/foo/bar.clj") (use 'foo.bar) In addition, (use 'foo.bar :reload-all) does not result in required effect, which is evaluating the modified bodies of functions and returning new values, instead of behaving as the source haven't changed at all. Documentation: load-file use Or (use 'your.namespace :reload) papachan There is also an alternative like using tools.namespace