Interactive programming (repl): Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) No edit summary |
(Undo revision 324512 by Drkameleon (talk) AWK solution taken out by mistake when editing Arturo solution.) |
||
Line 76: | Line 76: | ||
=={{header|Arturo}}== |
=={{header|Arturo}}== |
||
In Arturo's REPL: |
|||
<lang rebol>➜ $ arturo |
|||
<lang arturo>$ :001> f: @(a b sep) -> a + 2*sep + b |
|||
= <function> |
|||
⚫ | |||
= "Rosetta::Code"</lang> |
|||
=={{header|AWK}}== |
|||
Arturo |
|||
⚫ | |||
(c) 2019-2021 Yanis Zafirópulos |
|||
# syntax: GAWK -f CON GNU |
|||
# syntax: TAWK Thompson Automation |
|||
# v/0.9.6.5 b/1097 @ 2021-02-09T16:40:43+01:00 |
|||
</lang> |
|||
# arch: amd64/macosx |
|||
<p>Command, program, output:</p> |
|||
<pre> |
|||
# Type info 'symbol for info about a specific symbol or built-in function |
|||
GAWK -f CON |
|||
# Type help to get a list of all available functions with a short description |
|||
BEGIN { |
|||
# For multi-line input, just add a blank space at the end of a line |
|||
x = f("Rosetta","Code",":") |
|||
print(x) |
|||
# Launching interactive console - rock on! 🤘 |
|||
} |
|||
function f(s1,s2,s3) { return(s1 s3 s3 s2) } |
|||
$> f: function [x y sep]-> x ++ (repeat sep 2) ++ y |
|||
^Z <-- CTRL-Z |
|||
Rosetta::Code |
|||
</pre> |
|||
⚫ | |||
<p>Command (followed by welcome banner), program, output:</p> |
|||
<pre> |
|||
⚫ | |||
TAWK |
|||
TAWK Version 5.0c (for Windows/NT) |
|||
Copyright 1996 Thompson Automation, Inc. All Rights Reserved. |
|||
Enter AWK Program followed by a blank line: |
|||
BEGIN { |
|||
x = f("Rosetta","Code",":") |
|||
print(x) |
|||
} |
|||
function f(s1,s2,s3) { return(s1 s3 s3 s2) } |
|||
<-- blank line |
|||
Enter program arguments, if any: |
|||
<-- blank line |
|||
Rosetta::Code |
|||
</pre> |
|||
=={{header|BASIC}}== |
=={{header|BASIC}}== |