read-eval-print-loop

No command history in Python REPL when using with Cygwin under Windows 7

一笑奈何 提交于 2019-12-13 03:01:36
问题 I am running Python v3.6.4 under Windows 7. My problem is that when I log into the Python repl (command line interpreter) from Cygwin I lose the history feature of Python. The up and down arrows dont show me the command history but actually move my cursor up and down the screen. When I try the same using the Windows Terminal (CMD) the behaviour is different - I can access the full Python command history. This CMD behaviour is preferable when writing blocks of Python code in the repl

IDLE like interactive console for Ruby

霸气de小男生 提交于 2019-12-13 02:08:30
问题 I'm starting out with Ruby and was wondering if there's an interactive console similar to Python's IDLE, you know, with context highlighting and autocompletion. I've tried IRB, but it's fairly spartan (although it gets the work done; no question about that). Googling hasn't helped. You guys have any suggestions? 回答1: There are a lot of gems that add functionality to IRB (colored output, better history, formatted output, etc). Just search http://gemcutter.org for them. Next to that, IRB comes

Clojure Repl Unable to resolve symbol for all functions

不想你离开。 提交于 2019-12-12 14:50:08
问题 I have project created with Leiningen and following code in Core.clj file: (ns hyperstring.core (:use [clojure.pprint :only (pprint)]) (:require [clojure.java.io :as io] [clojure.string :as str]) (:import [java.io File])) ;;read file line by line (defn read-line-by-line [filepath] (with-open [rdr (reader filepath)] (doseq [line (line-seq rdr)] (println line)))) ;;write to a new file (defn write-file [filepath] (with-open [wrtr (writer filepath)] (.write wrtr "Line to be written"))) and other

How is ScalaRunTime.stringOf(x) not failing when x.toString fails?

旧街凉风 提交于 2019-12-12 09:42:26
问题 Whilst trying to figure out some joda-time DateTime (timestamp formatting) issues I opened a REPL with scala -cp joda-time-2.3.jar and forgot to add the joda-convert jar, and eventually got a java.lang.AssertionError: assertion failed: org.joda.convert.ToString (The entire stacktrace) I was able to simplify this to: > scala -cp joda-time-2.3.jar Welcome to Scala version 2.11.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_05). Type in expressions to have them evaluated. Type :help for more

How does one pre-load a clojure file in the leiningen repl?

那年仲夏 提交于 2019-12-12 07:49:55
问题 I have some clojure functions that I would like pre-loaded when I start the clojure REPL. The functions aren't much use unless you are using them within the context of a REPL. If it helps, I generally use leiningen to start a clojure REPL for me. How can I tell clojure (or leiningen, if it's not available through flat clojure) to pre-load a clojure file containing these definitions for me? 回答1: There are several ways to do this described in the leiningen sample project one of my favorite

How do i open a repl in a different namespace [duplicate]

时光怂恿深爱的人放手 提交于 2019-12-12 03:07:43
问题 This question already has answers here : How do I start the REPL in a user defined namespace? (7 answers) Closed 4 years ago . Specifically with a leiningen uberjar. java -cp myapp.jar clojure.main -r gets me a repl but defaults to the user namespace What do I need to do to get it to myapp's namespace? java -cp myapp.jar clojure.main -e (in-ns myapp.core) gives me clojure.lang.LispReader$ReaderException * Update * The ultimate goal is to simply run java -jar myapp.jar and have a Clojure REPL

Pasting into REPL with :paste

别来无恙 提交于 2019-12-12 01:28:09
问题 Looking at this SO post, I tried to paste the following code into Putty and Windows command line. def size(root: Leaf, left: Branch, right: Branch) : Int = { def go(branch: Branch, acc: Int) : Int = branch match { case Nil => acc case branch.left != Nil && branch.right != Nil => go(branch.left, acc) + go(branch.right, acc) case branch.left != Nil => go(branch.left, acc) case branch.right != Nil => go(branch.right, acc) case _ => 0 } root match { case Nil => go(left, 0) + go(right, 0) case _ =

No javap tool not found in Scala REPL

时光毁灭记忆、已成空白 提交于 2019-12-11 18:08:06
问题 I am using Scala 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_79) on Windows 10. I did following in REPL scala> class Book (val title:String) defined class Book scala> :javap :javap [-lcsvp] [path1 path2 ...] scala> :javap -c Book Failed: No javap tool available: scala.tools.nsc.interpreter.JavapClass$JavapTool6 failed to initialize. My PATH environment variable has C:\Program Files\Java\jdk1.7.0_79\bin and JAVA_HOME is set to C:\Program Files\Java\jdk1.7.0_79 I can see the javap.exe

REPL does not show input

霸气de小男生 提交于 2019-12-11 15:49:48
问题 I'm trying to write some Scala code in the Scala interpreter, using the following steps. I'm using Windows. Open command prompt and go to project root directory Type sbt then console to start Scala REPL It opens the Scala REPL with below message Message: D:\example\example>sbt "C:\Users\rajnish.kumar\.sbt\preloaded\org.scala-sbt\sbt\"1.0.4"\jars\sbt.jar" Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 [info] Loading project definition

Java - combine Scanner for file with Scanner for user input

可紊 提交于 2019-12-11 15:48:53
问题 Edit2: See below for some example code, this is left because people did reply to this question in its original form. Here's one from myself and my CS professor combined: We have an assignment where students are being asked to write a basic command interface for a modified subset of SQL. Doesn't really matter, but provides context. The requirements state that commands can be in a file or entered at a command prompt. Scanner seems natural for this, fairly obviously. So for this question, I'll