Questions tagged [read-eval-print-loop]
A Read-Eval-Print Loop (REPL) is the most common model for an interactive interpreter - it Reads input, Evaluates it, Prints it, and Loops back to the beginning.
1,476
questions
1
vote
0
answers
11
views
Is there a way to refer to the result of the previous command in PSCi?
Coming from Haskell, I'm accustomed to using it to refer to the result of the previous command in GHCi:
ghci> 1+1
2
ghci> :type it
it :: Num a => a
ghci> it*2
4
I went looking to see if ...
-1
votes
0
answers
26
views
Why does the Node.js REPL keep returning an infinite loop when I try to load my script?
I have been trying to load my script on the node.js REPL for some days now using the '.load' command without success! It just keeps loading the first line in an infinite loop until I k!ll the terminal....
0
votes
1
answer
80
views
.load Command Goes In An Infinite Loop When Trying To Load A File In Node.js REPL
I have an index.js file that I want to load in the Node REPL to try some stuff, but when I use .load index.js in the REPL, it goes in an infinite loop and keeps repeating the first line in the file ...
0
votes
0
answers
13
views
Cannot enable regular expression global flag in NodeJS REPL due to autocomplete
I want to write regular expression with global flag in NodeJS REPL like this
/abc/g
However I cannot add to g flag due to code autocomplete
When typing above code to RPEL, firstly, it displays a ...
0
votes
1
answer
14
views
How to run node "REPL" Module that syncs certain variables to the main context?
I was working on my new project, It's kinda like pm that manages multiple node instance
I am using REPL module, I have some commands
However there is 1 command that push a value to an array to tell a ...
2
votes
2
answers
53
views
Why do I need to evaluate defpackage for a new REPL?
I use ADSF to organise my projects.
(asdf:defsystem :sender
:version "0.1.4"
:serial t
:depends-on (:cl-json :dexador :clsql :clsql-sqlite3)
:components ((:file "packages")
...
0
votes
0
answers
34
views
Update value printed to console
I'm attempting to update a value printed to the console in order to implement a simple REPL that supports predictive commands.
So after "->" is printed to the screen using
Console.print(&...
0
votes
0
answers
44
views
node REPL gaves me an infinite loop
Here is my code
import mongoose from "mongoose";
const { Schema } = mongoose;
mongoose.set('strictQuery', false);
mongoose.connect('mongodb://127.0.0.1:27017/moviesdb')
.then(()=> {
...
0
votes
0
answers
9
views
How does a read-eval-print-loop (REPL) Works? How is the state of previous commands stored? does it recompile and runs again each time?
How is this achieved?
does it store in a file like test.py which has
# test.py
def foo():
print('foo was called')
foo()
and runs $ python test.py
I am asking about the internal workings of the ...
0
votes
0
answers
49
views
Problem running python cProfile in VSCode debug console
I'm trying to setup a good VSCode python environment for debugging including profiling using cProfile in a REPL manner, and I really like the debug widow.
In the VSCode debugger I am able to run/debug ...
3
votes
1
answer
26
views
Python Readline REPL Console Conficts with Gettext (underscore variable)
I'm using gettext for localization and installs the gettext() function to the global _ variable. However, the readline console I'm using for debug purposes also uses _ as a special variable to refer ...
6
votes
2
answers
351
views
Pass Julia arguments to be executed in REPL?
I very (very!) often do this routine in my daily work:
$ j7 # (alias for Julia version 1.7)
julia>
julia> ] activate .
(or similarly) (@v1.8) pkg> activate .
Activating project at `~/...
1
vote
0
answers
39
views
Setting javaOptions in sbt:console task
How can I set javaOptions in an sbt project so that they'll be properly propagated inside the sbt:console task? I want have the vector incubator module visible inside the sbt console repl.
By adding ...
1
vote
2
answers
39
views
Why Lua's builtin REPL cannot access previously delcared local vars?
See the following example:
$ lua
Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio
> local a = 123
> print(a)
nil
This works as expected:
> local a = 123; print(a)
123
How should I ...
0
votes
0
answers
33
views
Working code on Svelte REPL not working on Codesandbox
What makes the svelte REPL and other REPL's different? I tried to copy my working code on svelte REPL, both on my local computer and Codesandbox, but it's not working properly like on the svelte REPL.
...
0
votes
1
answer
24
views
Unable to build flux repl in WSL
I am trying to build the flux repl into wsl in Window 10
I followed the instructions as per the repo (https://github.com/influxdata/flux/#requirements)
When I run the build command
$ go build ./cmd/...
0
votes
1
answer
70
views
Lark: How to ignore whitespace after parsing?
I am creating a REPL for Linux commands.
Since my grammar for command is call: WS? (redirection WS)* argument (WS atom)* WS?, once the parsing is done, I always find whitespace is included as one of ...
1
vote
1
answer
68
views
How do I clear all variables in node REPL?
I open a REPL on my terminal with node or node -i.
After playing around, I’d like to clear everything in this REPL (chiefly the JS variables that I created). Is there a command to do that? I currently ...
-5
votes
1
answer
286
views
node.js readline (or similar) tool to manage a better prompt interface [closed]
I am using readline to manage a program that will have events emitted to it from a websocket connection. The problem I have is that when messages are emitted to stdout, the formatting of the tty is ...
-1
votes
1
answer
49
views
How to open REPL in vim using fireplace plugin
I have vim-fireplace plugin installed using https://github.com/tpope/vim-fireplace's readme as follows:
First cider-nrepl installation by adding line {:user {:plugins [[cider/cider-nrepl "0.28.5&...
1
vote
1
answer
98
views
How to convert r6rs macro involving syntax-case to racket?
I am learning scheme/racket macros, and trying to make the following macro from sweet-macros work under racket 8.6.
#lang racket
(require (for-meta 1 srfi/1)) ; for cons* and fold-right
(provide ...
0
votes
0
answers
134
views
How to make GHCI put new line before expression result
If I type 1 + 2 into ghci and press enter key, I see this(screenshot below). I would like the result(3 in this case) to be printed on the next line after expression. Is there any way to do this or is ...
0
votes
0
answers
22
views
jupyter cells act like python, not ipython. I have ipykernel 6.9.1 - any ideas how to get ipython working in jlab?
I use ipython regularly and expect to use it within jupyter, but the features are not available.
I downloaded and installed the anaconda3 python/jupyter packages recently and am running them. My ...
0
votes
1
answer
32
views
Why is code printing "invalid literal for int() with base 10:" when running through mcdonalds and what does it mean?
When I run my code, it does not error out until it gets to the random.randint part of the code. I tried removing the mcdonalds part but the 2nd part does not work either. I have done this before with ...
0
votes
2
answers
57
views
How to get out of while loop "...." and continue new line
How can I end writing while loop and continue a new line while writing the code in the terminal?
>>> while True:
... print('W')
...
0
votes
1
answer
26
views
What is the traceback/local jumpback error in irb repl when writing multiline code?
I am a newbie, forgive if this is an obvious question but does anyone know why my irb repl isn't able to do multilines? I have tried lots of different if statements (copied from course notes that I am ...
0
votes
0
answers
26
views
White, green, blue, purple javaScript elements in Repl: what are they?
I'm learning to code javaScript. The arguments I type are displayed in different colors. I know that the colors signify the type of element I just entered (string, conditional, etc.). But I don't know ...
0
votes
1
answer
35
views
in "node:vm" when context is array how access the keys
How to access the key on the context when using node:vm module with context that is an instance of Array. Because as using numbers just vm just eval the number and return it back
import vm from 'node:...
0
votes
1
answer
95
views
Where is the "Hello world" going to be printed after following shadow-cljs documentation to watch the app?
I am following shadow-cljs Quick Start documentation on a minimal example of a project. Here is the link.
I have this shadow-cljs.edn file:
;; shadow-cljs configuration
{:source-paths
["src/dev&...
0
votes
0
answers
26
views
NodeJS REPL command line argument
Node help says its possible to pass arguments:
$ node -h
Usage: node [options] [ script.js ] [arguments]
I am making a troubelshooter using the REPL interface and a bootstrap file. Passing an custom ...
0
votes
1
answer
73
views
How to make the connection between Emacs, Cider, and shadow-cljs be less repetitive per project?
I have been using Clojure, ClojureScript, lein, shadow-cljs, re-frame, reagent, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic web app project.
Usually, I build the project by executing ...
0
votes
1
answer
102
views
How to make the browser connection to the shadow-cljs nREPL be longer?
I have been using Clojure, ClojureScript, lein, shadow-cljs, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic web app project.
Usually, I build the project executing command cider-jack-in-...
0
votes
1
answer
100
views
Why I can start CIDER's Clojure REPL without a project (no error message) but starting CIDER's clojureScript REPL without a project returns an error?
I have been using with some success the stack of Clojure, ClojureScript, lein, shadow-cljs, Emacs, and CIDER.
Usually, inside a project and for ClojureScript projects, I do: cider-jack-in-cljs, I ...
0
votes
1
answer
30
views
How do I load the latest code in Cake REPL?
When I make changes to my Entity code, the changes only reflect after restarting the REPL console. How do I always have the latest code in my REPL console?
./bin/cake console
> $ac_table = Cake\...
0
votes
0
answers
21
views
Why does this pre-fixed namespace evaluation of a variable work in ClojureScript while REPL namespace navigation does not work?
I am using Clojure, ClojureScript, shadow-cljs, Emacs, Cider, and Lein to develop a web app project.
As you see below, I am able to evaluate a variable (all-account-ks) using the namespace as a prefix:...
0
votes
1
answer
54
views
Why does CIDER's REPL some times start as "shadow.user>" and in others it starts as "cljs.user>"?
I am using Clojure, ClojureScript, shadow-cljs, Emacs, Cider, and Lein to develop a web app project.
This is the usual workflow: inside a project and for ClojureScript projects, execute cider-jack-in-...
0
votes
1
answer
78
views
Why is CIDER's REPL's behavior inconsistent? How to understand shadow-cljs' error message "No available JS runtime"?
I am using Clojure, ClojureScript, shadow-cljs, Emacs, Cider, and Lein to develop a web app project.
The web application has been successfully built. I can access the interface on http://localhost:...
1
vote
1
answer
53
views
Is there a way to store and retrieve the history of shadow-cljs' REPL over different sessions? How to use commands used in previous sessions?
I am using Emacs, CIDER, and shadow-clj/shadow-cljs to develop a project
in Clojure/ClojureScript. All this in a macOS Monterey 12.5.
Before that, I was used to programming with Emacs, Slime, Common ...
0
votes
1
answer
46
views
This expression has type int list but an expression was expected of type unit
I tried this in utop but since I am not familar with a dune project, it failed and report the error
This expression has type int list but an expression was expected of type unit.
This is for the ...
1
vote
1
answer
70
views
If clojure has "require" then why does it have "compile"
If require takes care of compiling a namespace, then why do we need compile in Clojure?
For eg - I can only run the require statement instead of running the below two statements:
(require '[<name ...
1
vote
1
answer
62
views
SICP Streams (Scheme) - CDR into the implicit stream of ones
(define ones (cons-stream 1 ones))
(stream-cdr ones)
returns an infinite sequence of evaluated 1s - i.e. I get
;Value: #0={1 1 1 1 1 1 1 and so on... - not the symbolic {1 1 ...} I would expect ...
...
0
votes
1
answer
81
views
Why spark-shell throws NoSuchMethodException while calling newInstance via reflection
spark-shell throws NoSuchMethodException if I define a class in REPL and then call newInstance via reflection.
Spark context available as 'sc' (master = yarn, app id = application_1656488084960_0162).
...
1
vote
2
answers
82
views
When I reset Slime, recompile and reinstall packages - why?
I have a SBCL package called frosty.
I am using SLIME with emacs. When I close emacs for the day, and then open it the next day, it's as if I am "starting again".
All my quicklisp packages ...
0
votes
0
answers
28
views
How to lazily work with files using llvm::SourceMgr and llvm::MemoryBuffer?
I use llvm::SourceMgr to print diagnostic messages on errors.
To do this, I must provide llvm::MemoryBuffer with whole content of a file.
This is undesired, because of:
Reading stdin untill EOF, ...
0
votes
1
answer
80
views
REPL not updating the code remotely - Clojure
I am experiencing an API issue where a partner is trying to do a POST request to my server but it looks like it is loading the previous code from my server.
The previous code contained an error:
#'clj-...
2
votes
1
answer
85
views
Why do I get a print of a tuple of Nones in the Python console, but not of a single None? [duplicate]
While using Python (via cmd) and writing this inside:
>>> import random
>>> print("hello"),print("world"),print(random.randint(5,10))
the output I'm getting is:
...
0
votes
3
answers
81
views
How CPython handles multiline input in REPL?
Python's REPL reads input line by line.
However, function definitions consist from multiple lines.
For example:
>>> def answer():
... return 42
...
>>> answer()
42
How does ...
1
vote
1
answer
103
views
Whenever I start a project, an error occurs :main namespace specified in project.clj
Whichever github project I run I get the same error.
Now I have started a simple example from the book clojure for brave and true and the same program appears.
(ns clojure-noob.core
(:gen-class))
(...
0
votes
0
answers
46
views
How to quickly generate REPL style python snippet from a script?
Question
If there is a python script like the following.
import pandas as pd
df = pd.DataFrame(
{
"col1": [1, 2],
"col2": [0.5, 0.75],
},
index=["...
0
votes
1
answer
29
views
Python REPLY Output is different in 2 scenarios
In the REPL, I get the following output for 2 different scenarios
1st Scenario
>>> 'This is a \" and a \' in a string'
'This is a " and a ' in a string'
2nd Scenario
>>> a ...