Interactive programming (repl): Difference between revisions

m
→‎{{header|Wren}}: Version change.
m (→‎{{header|Wren}}: Version change.)
 
(10 intermediate revisions by 5 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æ.
Fōrmulæ programs are not textual, visualization/edition of programs is done showing/manipulating structures but not text. Moreover, there can be multiple visual representations of the same program. Even though it is possible to have textual representation &mdash;i.e. XML, JSON&mdash; they are intended for storage and transfer purposes more than visualization and edition.
 
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.
Programs in Fōrmulæ are created/edited online in its [https://formulae.org website], However they run on execution servers. By default remote servers are used, but they are limited in memory and processing power, since they are intended for demonstration and casual use. A local server can be downloaded and installed, it has no limitations (it runs in your own computer). Because of that, example programs can be fully visualized and edited, but some of them will not run if they require a moderate or heavy computation/memory resources, and no local server is being used.
 
It is not necessary to install anything else.
In '''[https://formulae.org/?example=Interactive_programming this]''' page you can see the program(s) related to this task and their results.
 
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 666 ⟶ 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 705 ⟶ 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 782 ⟶ 822:
=={{header|Lang}}==
This example works with the LangShell from the Standard Lang implementation.
The lang shellLangShell can be started with (The LangShell does not run in the OS's shell, it will open a separate window):
<syntaxhighlight lang="shell">
$ lang -startShell
Line 789 ⟶ 829:
Lang-Shell - Press CTRL + C for cancelling execution or for exiting!
• Copy with (CTRL + SHIFT + C) and paste with (CTRL + SHIT + V)
• Press CTRL + SHIFT + S for openingsaving all inputs theto speciala char.lang inputfile window(Save)
• Press CTRL + SHIFT + S for saving all inputs to a .lang file (Save As...)
• Press CTRL + I for opening the special char input window
• Press CTRL + SHIFT + F for opening a file chooser to insert file paths
• Press UP and DOWN for scrolling through the history
• Press TAB and SHIFT + TAB for scrolling trough auto complete texts
Line 805 ⟶ 848:
Lang-Shell - Press CTRL + C for cancelling execution or for exiting!
• Copy with (CTRL + SHIFT + C) and paste with (CTRL + SHIT + V)
• Press CTRL + SHIFT + S for openingsaving all inputs theto speciala char.lang inputfile window(Save)
• Press CTRL + SHIFT + S for saving all inputs to a .lang file (Save As...)
• Press CTRL + I for opening the special char input window
• Press CTRL + SHIFT + F for opening a file chooser to insert file paths
• Press UP and DOWN for scrolling through the history
• Press TAB and SHIFT + TAB for scrolling trough auto complete texts
Line 1,911 ⟶ 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