Interactive programming (repl): Difference between revisions

m
→‎{{header|Wren}}: Version change.
m (→‎{{header|Wren}}: Version change.)
 
(7 intermediate revisions by 4 users not shown)
Line 384:
ELENA Script is a subset of the general language. ELT (Virtual machine terminal) can work in REPL mode
<syntaxhighlight lang="elena">
c:\Alex\ELENA\bin>elt-cli
ELENA command line VM terminal 56.10.137 (C)20112021-202023 by AlexeiAleksey Rakov
ELENA VM 56.10.1725 (C)20052022-20202023 by AlexAleksey Rakov
Initializing...
-q - quit
Done...
-c - clear
-h - help
-l <path> - execute a script from file
-p<script>; - prepend the prefix code
{ <script>; }*
<script> - execute script
 
>f-pf(s1,s2,sep){^ s1 + sep + sep + s2 };
 
>f("Rosetta","Code",":")
Line 555 ⟶ 561:
=={{header|Fōrmulæ}}==
 
The interactive mode (REPL) is the primary working mode in Fōrmulæ.
{{FormulaeEntry|page=https://formulae.org/?script=examples/Interactive_programming}}
 
To use it, open the web address [https://formulae.org/ formulae.org] in your browser. it is preferable to use this environment in a desktop web browser.
 
It is not necessary to install anything else.
 
A page with information is shown. You can start a new script using the [[File:Fōrmulæ - Interactive programming 05.png|border]] tool (new document).
 
[[File:Fōrmulæ - Interactive programming 04.png|border]]
 
=={{header|GAP}}==
Line 662 ⟶ 676:
 
WRITE(ClipBoard) TRIM(A) // ':' // TRIM(C) // TRIM(B) ! Rosetta::Code</syntaxhighlight>
 
=={{Header|Insitux}}==
 
First is the system shell, when Insitux has been already been installed system-wide (<code>npm i -g insitux</code>).
 
<pre>
$ npx ix
Insitux 230728 REPL
❯ (function f s1 s2 sep (str s1 sep sep s2))
❯ (f "Rosetta" "Code" ":")
Rosetta::Code
</pre>
 
=={{header|Io}}==
Line 701 ⟶ 728:
 
Rosetta::Code
</syntaxhighlight>
Alternatively
<syntaxhighlight lang="java">
Java has an interactive REPL (Read-Evaluate-Print-Loop) console, jshell, that is included with the JDK.
The REPL is started by invoking: $JAVA_HOME/bin/jshell
Here is a sample session to accomplish the task.
| Welcome to JShell -- Version 20
| For an introduction type: /help
 
jshell> String concat(String a, String b, String c) { return a + c + c + b; }
| created method concat(String, String, String)
jshell> concat("Rosetta", "Code", ":")
$2 ==> "Rosetta::Code"
jshell>
</syntaxhighlight>
 
Line 1,913 ⟶ 1,957:
$ ./wren
\\/"-
\_/ wren v0.24.0
> var f = Fn.new { |s1, s2, sep| s1 + sep + sep + s2 }
> f.call("Rosetta", "Code", ":")
9,476

edits