Interactive programming (repl): Difference between revisions
Content added Content deleted
(→{{header|Huginn}}: deleted 4 year old dead link + pointless entry. User Amok, the original poster, has not posted anything for 3 years.) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 101: | Line 101: | ||
A Basic interpreter is in command mode by default. Enter the following in command mode: |
A Basic interpreter is in command mode by default. Enter the following in command mode: |
||
< |
<syntaxhighlight lang="qbasic">10 DEF FN f$(a$, b$, s$) = a$+s$+s$+b$ |
||
PRINT FN f$("Rosetta", "Code", ":")</ |
PRINT FN f$("Rosetta", "Code", ":")</syntaxhighlight> |
||
==={{header|Applesoft BASIC}}=== |
==={{header|Applesoft BASIC}}=== |
||
Line 124: | Line 124: | ||
The two modes are RUN mode, and the default "DIRECT" mode. In direct mode, spaces are ignored except within strings. Entering ? is shorthand for the PRINT keyword. Using GET, INPUT, or DEF FN will result in an ?ILLEGAL DIRECT ERROR. The DATA statement is ignored. |
The two modes are RUN mode, and the default "DIRECT" mode. In direct mode, spaces are ignored except within strings. Entering ? is shorthand for the PRINT keyword. Using GET, INPUT, or DEF FN will result in an ?ILLEGAL DIRECT ERROR. The DATA statement is ignored. |
||
< |
<syntaxhighlight lang="gwbasic">] 0 IF F$ = "F" THEN RESULT$ = P1$ + P3$ + P3$ + P2$: END |
||
] F$ = "F":P1$ = "ROSETTA":P2$ = "CODE":P3$ = ":": GOTO |
] F$ = "F":P1$ = "ROSETTA":P2$ = "CODE":P3$ = ":": GOTO |
||
] ?RESULT$ |
] ?RESULT$ |
||
ROSETTA::CODE</ |
ROSETTA::CODE</syntaxhighlight> |
||
=={{header|Batch File}}== |
=={{header|Batch File}}== |
||
CMD.EXE is the CLI for Batch Files. Batch Files do not have traditional functions and doing the [http://rosettacode.org/wiki/Call_a_function#Batch_File alternative] will not work in interactive mode. So this example uses blocks of code. |
CMD.EXE is the CLI for Batch Files. Batch Files do not have traditional functions and doing the [http://rosettacode.org/wiki/Call_a_function#Batch_File alternative] will not work in interactive mode. So this example uses blocks of code. |
||
{{trans|BBC BASIC}} |
{{trans|BBC BASIC}} |
||
< |
<syntaxhighlight lang="dos">>set r=Rosetta |
||
>set c=Code |
>set c=Code |
||
Line 142: | Line 142: | ||
Rosetta::Code |
Rosetta::Code |
||
></ |
></syntaxhighlight> |
||
=={{header|BBC BASIC}}== |
=={{header|BBC BASIC}}== |
||
Line 204: | Line 204: | ||
All BQN implementations start in interactive mode, when called from the command line with no arguments (using Node.js for [[mlochbaum/BQN]]). It is recommended to use <code>rlwrap</code> with the executable for a better REPL experience. |
All BQN implementations start in interactive mode, when called from the command line with no arguments (using Node.js for [[mlochbaum/BQN]]). It is recommended to use <code>rlwrap</code> with the executable for a better REPL experience. |
||
< |
<syntaxhighlight lang="bqn"> Join ← {a 𝕊 b‿c: b∾a∾a∾c} |
||
(function block) |
(function block) |
||
":" Join "Rosetta"‿"Code" |
":" Join "Rosetta"‿"Code" |
||
"Rosetta::Code"</ |
"Rosetta::Code"</syntaxhighlight> |
||
=={{header|Bracmat}}== |
=={{header|Bracmat}}== |
||
Line 235: | Line 235: | ||
=={{header|Brat}}== |
=={{header|Brat}}== |
||
< |
<syntaxhighlight lang="brat">$ brat |
||
# Interactive Brat |
# Interactive Brat |
||
brat:1> f = { a, b, s | a + s + s + b } |
brat:1> f = { a, b, s | a + s + s + b } |
||
Line 242: | Line 242: | ||
#=> Rosetta::Code |
#=> Rosetta::Code |
||
brat:3> quit |
brat:3> quit |
||
Exiting</ |
Exiting</syntaxhighlight> |
||
=={{header|Burlesque}}== |
=={{header|Burlesque}}== |
||
< |
<syntaxhighlight lang="burlesque"> |
||
C:\Burlesque>Burlesque.exe --shell |
C:\Burlesque>Burlesque.exe --shell |
||
blsq ) {+]?+}hd"Rosetta""Code"':!a |
blsq ) {+]?+}hd"Rosetta""Code"':!a |
||
"Rosetta:Code" |
"Rosetta:Code" |
||
blsq ) |
blsq ) |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|C sharp}}== |
=={{header|C sharp}}== |
||
Line 295: | Line 295: | ||
=={{header|Clojure}}== |
=={{header|Clojure}}== |
||
With ''clojure.jar'' on the Java classpath, the Clojure REPL is invoked with ''java clojure.main''. |
With ''clojure.jar'' on the Java classpath, the Clojure REPL is invoked with ''java clojure.main''. |
||
< |
<syntaxhighlight lang="lisp"> |
||
Clojure 1.1.0 |
Clojure 1.1.0 |
||
user=> (defn f [s1 s2 sep] (str s1 sep sep s2)) |
user=> (defn f [s1 s2 sep] (str s1 sep sep s2)) |
||
Line 302: | Line 302: | ||
"Rosetta::Code" |
"Rosetta::Code" |
||
user=> |
user=> |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|CoffeeScript}}== |
=={{header|CoffeeScript}}== |
||
With the [https://www.npmjs.com/package/coffee-script coffee-script] package for [https://www.npmjs.org/ NPM] on [http://nodejs.org/ Node.js]. The ''-n'' flag is '--node'. |
With the [https://www.npmjs.com/package/coffee-script coffee-script] package for [https://www.npmjs.org/ NPM] on [http://nodejs.org/ Node.js]. The ''-n'' flag is '--node'. |
||
<syntaxhighlight lang="coffeescript"> |
|||
<lang CoffeeScript> |
|||
$ coffee -n |
$ coffee -n |
||
coffee> f = (a, b, c) -> a + c + c + b |
coffee> f = (a, b, c) -> a + c + c + b |
||
Line 312: | Line 312: | ||
coffee> f "Rosetta", "Code", ":" |
coffee> f "Rosetta", "Code", ":" |
||
"Rosetta::Code" |
"Rosetta::Code" |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |
||
The details of interactive use vary widely between implementations; this example is from [[SBCL]]. <code>*</code> is the prompt. By default, SBCL compiles (not interprets) all code, unless <code>[http://www.sbcl.org/manual/Interpreter.html sb-ext:*evaluator-mode*]</code> is changed. |
The details of interactive use vary widely between implementations; this example is from [[SBCL]]. <code>*</code> is the prompt. By default, SBCL compiles (not interprets) all code, unless <code>[http://www.sbcl.org/manual/Interpreter.html sb-ext:*evaluator-mode*]</code> is changed. |
||
< |
<syntaxhighlight lang="lisp">$ rlwrap sbcl |
||
This is SBCL 1.0.25, an implementation of ANSI Common Lisp. |
This is SBCL 1.0.25, an implementation of ANSI Common Lisp. |
||
More information about SBCL is available at <http://www.sbcl.org/>. |
More information about SBCL is available at <http://www.sbcl.org/>. |
||
Line 328: | Line 328: | ||
"Rosetta::Code" |
"Rosetta::Code" |
||
*</ |
*</syntaxhighlight> |
||
=={{header|Déjà Vu}}== |
=={{header|Déjà Vu}}== |
||
Line 334: | Line 334: | ||
The interactive interpreter provides <code>.</code> as a shortcut for <code>!.</code> and <code>;</code> as a shortcut for <code>!(print-stack)</code>. |
The interactive interpreter provides <code>.</code> as a shortcut for <code>!.</code> and <code>;</code> as a shortcut for <code>!(print-stack)</code>. |
||
< |
<syntaxhighlight lang="dejavu">$ vu |
||
<1:1> f str1 str2 sep: |
<1:1> f str1 str2 sep: |
||
<1:2> join sep [ str2 "" str1 ] |
<1:2> join sep [ str2 "" str1 ] |
||
<1:3> |
<1:3> |
||
<2:1> . f "Rosetta" "Code" ":" |
<2:1> . f "Rosetta" "Code" ":" |
||
"Rosetta::Code"</ |
"Rosetta::Code"</syntaxhighlight> |
||
=={{header|E}}== |
=={{header|E}}== |
||
< |
<syntaxhighlight lang="e">$ rune # from an OS shell. On Windows there is also a desktop shortcut.</syntaxhighlight> |
||
"<code>?</code>" and "<code>></code>" are prompts for input; "<code>#</code>" marks output. |
"<code>?</code>" and "<code>></code>" are prompts for input; "<code>#</code>" marks output. |
||
< |
<syntaxhighlight lang="e">? def f(string1 :String, string2 :String, separator :String) { |
||
> return separator.rjoin(string1, "", string2) |
> return separator.rjoin(string1, "", string2) |
||
> } |
> } |
||
Line 353: | Line 353: | ||
? f("Rosetta", "Code", ":") |
? f("Rosetta", "Code", ":") |
||
# value: "Rosetta::Code"</ |
# value: "Rosetta::Code"</syntaxhighlight> |
||
If you type a definitely incomplete expression, such as "<code>def f() {</code>", then it gives an "<code>></code>" prompt and takes additional lines. If the expression is not necessarily incomplete, you can continue anyway by ending a line with "<code>\</code>". |
If you type a definitely incomplete expression, such as "<code>def f() {</code>", then it gives an "<code>></code>" prompt and takes additional lines. If the expression is not necessarily incomplete, you can continue anyway by ending a line with "<code>\</code>". |
||
Line 359: | Line 359: | ||
=={{header|EchoLisp}}== |
=={{header|EchoLisp}}== |
||
EchoLisp runs in a browser window, and is -par essence - interactive. To start the REPL mode, type http://www.echolalie.org/echolisp in the browser URL address field. |
EchoLisp runs in a browser window, and is -par essence - interactive. To start the REPL mode, type http://www.echolalie.org/echolisp in the browser URL address field. |
||
< |
<syntaxhighlight lang="scheme"> |
||
;; screen copy of the REPL |
;; screen copy of the REPL |
||
;; note that the &i variables remember expression evaluation, and may be used in other expressions |
;; note that the &i variables remember expression evaluation, and may be used in other expressions |
||
Line 379: | Line 379: | ||
;; etc. |
;; etc. |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
ELENA Script is a subset of the general language. ELT (Virtual machine terminal) can work in REPL mode |
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 |
c:\Alex\ELENA\bin>elt |
||
ELENA command line VM terminal 5.1.13 (C)2011-2020 by Alexei Rakov |
ELENA command line VM terminal 5.1.13 (C)2011-2020 by Alexei Rakov |
||
Line 395: | Line 395: | ||
Rosetta::Code |
Rosetta::Code |
||
> |
> |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Elixir}}== |
=={{header|Elixir}}== |
||
Elixir's Interactive REPL is IEx, Interactive Elixir. To open IEx, open a shell and type: iex<br> |
Elixir's Interactive REPL is IEx, Interactive Elixir. To open IEx, open a shell and type: iex<br> |
||
The 'def' keyword isn't allowed outside of modules in Elixir, so the easiest way to write a function in iex is usually by writing an anonymous function. |
The 'def' keyword isn't allowed outside of modules in Elixir, so the easiest way to write a function in iex is usually by writing an anonymous function. |
||
< |
<syntaxhighlight lang="elixir">iex(1)> f = fn str1,str2,sep -> [str1,"",str2] |> Enum.join(sep) end # Join list on separator |
||
iex(2)> g = fn str1,str2,sep -> str1 <> sep <> sep <> str2 end # Or concatenate strings |
iex(2)> g = fn str1,str2,sep -> str1 <> sep <> sep <> str2 end # Or concatenate strings |
||
Line 406: | Line 406: | ||
...(3)> def f(str1,str2,sep), do: [str1,"",str2] |> Enum.join(sep) |
...(3)> def f(str1,str2,sep), do: [str1,"",str2] |> Enum.join(sep) |
||
...(3)> def g(str1,str2,sep), do: str1 <> sep <> sep <> str2 |
...(3)> def g(str1,str2,sep), do: str1 <> sep <> sep <> str2 |
||
...(3)> end</ |
...(3)> end</syntaxhighlight> |
||
'''Example:''' |
'''Example:''' |
||
< |
<syntaxhighlight lang="elixir">iex(4)> f.("Rosetta","Code",":") |
||
"Rosetta::Code" |
"Rosetta::Code" |
||
iex(5)> JoinStrings.f("Rosetta","Code",":") |
iex(5)> JoinStrings.f("Rosetta","Code",":") |
||
"Rosetta::Code"</ |
"Rosetta::Code"</syntaxhighlight> |
||
=={{header|Emacs Lisp}}== |
=={{header|Emacs Lisp}}== |
||
Line 419: | Line 419: | ||
Switch to the buffer (<code>C-x b *scratch*</code>, or use the Buffers menu), type some Lisp expressions, and press <code>C-j</code> after each expression. |
Switch to the buffer (<code>C-x b *scratch*</code>, or use the Buffers menu), type some Lisp expressions, and press <code>C-j</code> after each expression. |
||
< |
<syntaxhighlight lang="lisp">(defun my-join (str1 str2 sep) |
||
(concat str1 sep sep str2)) |
(concat str1 sep sep str2)) |
||
my-join |
my-join |
||
(my-join "Rosetta" "Code" ":") |
(my-join "Rosetta" "Code" ":") |
||
"Rosetta::Code"</ |
"Rosetta::Code"</syntaxhighlight> |
||
Emacs also provides ''ielm'', the interactive Emacs Lisp mode. Start it with <code>M-x ielm</code>, type some expressions and press <code>RET</code>. |
Emacs also provides ''ielm'', the interactive Emacs Lisp mode. Start it with <code>M-x ielm</code>, type some expressions and press <code>RET</code>. |
||
< |
<syntaxhighlight lang="lisp">*** Welcome to IELM *** Type (describe-mode) for help. |
||
ELISP> (defun my-join (str1 str2 sep) |
ELISP> (defun my-join (str1 str2 sep) |
||
(concat str1 sep sep str2)) |
(concat str1 sep sep str2)) |
||
Line 433: | Line 433: | ||
ELISP> (my-join "Rosetta" "Code" ":") |
ELISP> (my-join "Rosetta" "Code" ":") |
||
"Rosetta::Code" |
"Rosetta::Code" |
||
ELISP> </ |
ELISP> </syntaxhighlight> |
||
=={{header|Erlang}}== |
=={{header|Erlang}}== |
||
< |
<syntaxhighlight lang="erlang">$erl |
||
1> F = fun(X,Y,Z) -> string:concat(string:concat(X,Z),string:concat(Z,Y)) end. |
1> F = fun(X,Y,Z) -> string:concat(string:concat(X,Z),string:concat(Z,Y)) end. |
||
#Fun<erl_eval.18.105910772> |
#Fun<erl_eval.18.105910772> |
||
2> F("Rosetta", "Code", ":"). |
2> F("Rosetta", "Code", ":"). |
||
"Rosetta::Code" |
"Rosetta::Code" |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|ERRE}}== |
=={{header|ERRE}}== |
||
Line 462: | Line 462: | ||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |
||
The F# interpreter is called '''fsi'''. As F# accepts multi-line input it will not evaluate the input until you enter two semi-colons together. |
The F# interpreter is called '''fsi'''. As F# accepts multi-line input it will not evaluate the input until you enter two semi-colons together. |
||
< |
<syntaxhighlight lang="fsharp">Microsoft F# Interactive, (c) Microsoft Corporation, All Rights Reserved |
||
F# Version 1.9.6.2, compiling for .NET Framework Version v2.0.50727 |
F# Version 1.9.6.2, compiling for .NET Framework Version v2.0.50727 |
||
Line 473: | Line 473: | ||
> f "Rosetta" "Code" ":" ;; |
> f "Rosetta" "Code" ":" ;; |
||
val it : string = "Rosetta::Code"</ |
val it : string = "Rosetta::Code"</syntaxhighlight> |
||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
Factor comes with a graphical interpreter called the listener. The listener can also be run in a console with the following command: |
Factor comes with a graphical interpreter called the listener. The listener can also be run in a console with the following command: |
||
./factor -run=listener |
./factor -run=listener |
||
< |
<syntaxhighlight lang="factor">( scratchpad ) : cool-func ( w1 w2 sep -- res ) dup append glue ; |
||
( scratchpad ) "Rosetta" "Code" ":" cool-func . |
( scratchpad ) "Rosetta" "Code" ":" cool-func . |
||
"Rosetta::Code"</ |
"Rosetta::Code"</syntaxhighlight> |
||
=={{header|Fantom}}== |
=={{header|Fantom}}== |
||
Line 499: | Line 499: | ||
All Forth systems come with an interpreter. On embedded systems, the interpreter functions as a monitor or lightweight operating system. |
All Forth systems come with an interpreter. On embedded systems, the interpreter functions as a monitor or lightweight operating system. |
||
< |
<syntaxhighlight lang="forth">$ gforth |
||
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc. |
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc. |
||
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license' |
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license' |
||
Line 512: | Line 512: | ||
ok |
ok |
||
s" :" s" Code" s" Rosetta" f cr type |
s" :" s" Code" s" Rosetta" f cr type |
||
Rosetta::Code ok</ |
Rosetta::Code ok</syntaxhighlight> |
||
=={{header|FreeBASIC}}== |
=={{header|FreeBASIC}}== |
||
Line 522: | Line 522: | ||
For example, the current task can be coded as follows and compiles/runs instantly : |
For example, the current task can be coded as follows and compiles/runs instantly : |
||
< |
<syntaxhighlight lang="freebasic">' FB 1.05.0 Win64 |
||
Dim As String s1, s2, sep |
Dim As String s1, s2, sep |
||
Line 529: | Line 529: | ||
Input "Separator "; sep |
Input "Separator "; sep |
||
Print : Print s1 + sep + sep + s2 |
Print : Print s1 + sep + sep + s2 |
||
Sleep</ |
Sleep</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 543: | Line 543: | ||
Frink is distributed as a single <CODE>.jar</CODE> file that will run in a Java Virtual Machine. On many operating systems, just double-clicking this <CODE>.jar</CODE> file will run Frink with a graphical interface in an interactive mode. By specifying a different main-class (<CODE>frink.parser.Frink</CODE>) when starting Frink, it can be run in a text-mode interactive mode as well. These options and sample starter scripts for various operating systems are provided in the [https://frinklang.org/#RunningFrink Running Frink] section of the documentation. |
Frink is distributed as a single <CODE>.jar</CODE> file that will run in a Java Virtual Machine. On many operating systems, just double-clicking this <CODE>.jar</CODE> file will run Frink with a graphical interface in an interactive mode. By specifying a different main-class (<CODE>frink.parser.Frink</CODE>) when starting Frink, it can be run in a text-mode interactive mode as well. These options and sample starter scripts for various operating systems are provided in the [https://frinklang.org/#RunningFrink Running Frink] section of the documentation. |
||
< |
<syntaxhighlight lang="frink">$ java -cp frink.jar frink.parser.Frink |
||
f[a,b,s] := "$a$s$s$b" |
f[a,b,s] := "$a$s$s$b" |
||
f["Rosetta", "Code", ":"]</ |
f["Rosetta", "Code", ":"]</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 562: | Line 562: | ||
=={{header|GAP}}== |
=={{header|GAP}}== |
||
< |
<syntaxhighlight lang="gap">~% gap |
||
######### ###### ########### ### |
######### ###### ########### ### |
||
Line 600: | Line 600: | ||
gap> join("Rosetta", "Code", ":"); |
gap> join("Rosetta", "Code", ":"); |
||
"Rosetta::Code" |
"Rosetta::Code" |
||
gap></ |
gap></syntaxhighlight> |
||
=={{header|Go}}== |
=={{header|Go}}== |
||
Line 608: | Line 608: | ||
The complete program satisfying the task is, |
The complete program satisfying the task is, |
||
< |
<syntaxhighlight lang="go">package main |
||
import "fmt" |
import "fmt" |
||
Line 618: | Line 618: | ||
func main() { |
func main() { |
||
fmt.Println(f("Rosetta", "Code", ":")) |
fmt.Println(f("Rosetta", "Code", ":")) |
||
}</ |
}</syntaxhighlight> |
||
It works well to enter the program, check "every keystroke" to see syntax errors from whatever silly oversights you made, then fix them one by one until your desired output appears. |
It works well to enter the program, check "every keystroke" to see syntax errors from whatever silly oversights you made, then fix them one by one until your desired output appears. |
||
Line 627: | Line 627: | ||
=={{header|Groovy}}== |
=={{header|Groovy}}== |
||
The '''groovysh''' interpreter requires a command-line interpreter (terminal) environment in which to run. This example was run under the CMD command-line interpreter on Microsoft Windows XP. |
The '''groovysh''' interpreter requires a command-line interpreter (terminal) environment in which to run. This example was run under the CMD command-line interpreter on Microsoft Windows XP. |
||
< |
<syntaxhighlight lang="groovy">C:\Apps\groovy>groovysh |
||
Groovy Shell (1.6.2, JVM: 1.6.0_13) |
Groovy Shell (1.6.2, JVM: 1.6.0_13) |
||
Type 'help' or '\h' for help. |
Type 'help' or '\h' for help. |
||
Line 638: | Line 638: | ||
groovy:000> exit |
groovy:000> exit |
||
C:\Apps\groovy></ |
C:\Apps\groovy></syntaxhighlight> |
||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
Line 644: | Line 644: | ||
The details of interactive use vary widely between implementations. This example is from [[GHC|GHCi]]. |
The details of interactive use vary widely between implementations. This example is from [[GHC|GHCi]]. |
||
< |
<syntaxhighlight lang="haskell">$ ghci |
||
___ ___ _ |
___ ___ _ |
||
/ _ \ /\ /\/ __(_) |
/ _ \ /\ /\/ __(_) |
||
Line 654: | Line 654: | ||
Prelude> let f as bs sep = as ++ sep ++ sep ++ bs |
Prelude> let f as bs sep = as ++ sep ++ sep ++ bs |
||
Prelude> f "Rosetta" "Code" ":" |
Prelude> f "Rosetta" "Code" ":" |
||
"Rosetta::Code"</ |
"Rosetta::Code"</syntaxhighlight> |
||
=={{header|HicEst}}== |
=={{header|HicEst}}== |
||
Line 660: | Line 660: | ||
"c:\Program Files\HicEst\HicEst.exe E:\Rosetta\Interactive_programming.hic f('Rosetta', 'Code', ':')" |
"c:\Program Files\HicEst\HicEst.exe E:\Rosetta\Interactive_programming.hic f('Rosetta', 'Code', ':')" |
||
<br>Type the following script. Each line is executed (and incrementally compiled) when it is typed: |
<br>Type the following script. Each line is executed (and incrementally compiled) when it is typed: |
||
< |
<syntaxhighlight lang="hicest">CHARACTER A*40, B*40, C*40 |
||
READ(Text=$CMD_LINE, Format="'','','',") A, B, C |
READ(Text=$CMD_LINE, Format="'','','',") A, B, C |
||
WRITE(ClipBoard, Name) A, B, C ! A=Rosetta; B=Code; C=:; |
WRITE(ClipBoard, Name) A, B, C ! A=Rosetta; B=Code; C=:; |
||
WRITE(ClipBoard) TRIM(A) // ':' // TRIM(C) // TRIM(B) ! Rosetta::Code</ |
WRITE(ClipBoard) TRIM(A) // ':' // TRIM(C) // TRIM(B) ! Rosetta::Code</syntaxhighlight> |
||
=={{header|Io}}== |
=={{header|Io}}== |
||
Line 689: | Line 689: | ||
This is a session log once the os specific stuff has been handled: |
This is a session log once the os specific stuff has been handled: |
||
< |
<syntaxhighlight lang="j"> f=: [: ; 0 2 2 1&{ |
||
f 'Rosetta';'Code';':' |
f 'Rosetta';'Code';':' |
||
Rosetta::Code</ |
Rosetta::Code</syntaxhighlight> |
||
=={{header|Java}}== |
=={{header|Java}}== |
||
< |
<syntaxhighlight lang="java"> |
||
public static void main(String[] args) { |
public static void main(String[] args) { |
||
System.out.println(concat("Rosetta", "Code", ":")); |
System.out.println(concat("Rosetta", "Code", ":")); |
||
Line 705: | Line 705: | ||
Rosetta::Code |
Rosetta::Code |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|JavaScript}}== |
=={{header|JavaScript}}== |
||
{{works with|Rhino}} |
{{works with|Rhino}} |
||
< |
<syntaxhighlight lang="javascript">$ java -cp js.jar org.mozilla.javascript.tools.shell.Main |
||
Rhino 1.7 release 2 2009 03 22 |
Rhino 1.7 release 2 2009 03 22 |
||
js> function f(a,b,s) {return a + s + s + b;} |
js> function f(a,b,s) {return a + s + s + b;} |
||
Line 715: | Line 715: | ||
Rosetta::Code |
Rosetta::Code |
||
js> quit() |
js> quit() |
||
$</ |
$</syntaxhighlight> |
||
=={{header|Jsish}}== |
=={{header|Jsish}}== |
||
Line 754: | Line 754: | ||
=={{header|K}}== |
=={{header|K}}== |
||
{{works with|Kona}} |
{{works with|Kona}} |
||
< |
<syntaxhighlight lang="k">$ rlwrap k |
||
K Console - Enter \ for help |
K Console - Enter \ for help |
||
f:{x,z,z,y} |
f:{x,z,z,y} |
||
f["Rosetta";"Code";":"] |
f["Rosetta";"Code";":"] |
||
"Rosetta::Code"</ |
"Rosetta::Code"</syntaxhighlight> |
||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |
||
Kotlin has an interactive shell for the JVM which can be started by simply typing 'kotlinc' at the command line. Here's a sample interactive session to accomplish the specified task on Windows 10: |
Kotlin has an interactive shell for the JVM which can be started by simply typing 'kotlinc' at the command line. Here's a sample interactive session to accomplish the specified task on Windows 10: |
||
< |
<syntaxhighlight lang="scala">c:\kotlin-compiler-1.0.6>kotlinc |
||
Welcome to Kotlin version 1.0.6-release-127 (JRE 1.8.0_31-b13) |
Welcome to Kotlin version 1.0.6-release-127 (JRE 1.8.0_31-b13) |
||
Type :help for help, :quit for quit |
Type :help for help, :quit for quit |
||
Line 768: | Line 768: | ||
>>> f("Rosetta", "Code", ":") |
>>> f("Rosetta", "Code", ":") |
||
Rosetta::Code |
Rosetta::Code |
||
>>> :quit</ |
>>> :quit</syntaxhighlight> |
||
=={{header|Lasso}}== |
=={{header|Lasso}}== |
||
< |
<syntaxhighlight lang="lasso">#!/usr/bin/lasso9 |
||
// filename: interactive_demo |
// filename: interactive_demo |
||
Line 813: | Line 813: | ||
// deliver the result |
// deliver the result |
||
stdoutnl(concatenate_with_delimiter(#string1, #string2, #delimiter))</ |
stdoutnl(concatenate_with_delimiter(#string1, #string2, #delimiter))</syntaxhighlight> |
||
Called from the command line: ./interactive_demo |
Called from the command line: ./interactive_demo |
||
Line 821: | Line 821: | ||
=={{header|Lambdatalk}}== |
=={{header|Lambdatalk}}== |
||
Lambdatalk works in a small wiki, lambdatank. Evaluation is done in real time. |
Lambdatalk works in a small wiki, lambdatank. Evaluation is done in real time. |
||
< |
<syntaxhighlight lang="scheme"> |
||
{def F {lambda {:a :b :s} :a:s:s:b}} |
{def F {lambda {:a :b :s} :a:s:s:b}} |
||
-> F |
-> F |
||
Line 827: | Line 827: | ||
{F Rosetta Code :} |
{F Rosetta Code :} |
||
-> Rosetta::Code |
-> Rosetta::Code |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Lingo}}== |
=={{header|Lingo}}== |
||
Lingo/Director is usually started as GUI program and has no access to the standard system console (unless using a binary plugin). But it has its own interactive Lingo console called "Message Window", that can be activated/displayed by executing "_player.debugPlaybackEnabled=1". Using this Message Window, the task can be solved like this: |
Lingo/Director is usually started as GUI program and has no access to the standard system console (unless using a binary plugin). But it has its own interactive Lingo console called "Message Window", that can be activated/displayed by executing "_player.debugPlaybackEnabled=1". Using this Message Window, the task can be solved like this: |
||
< |
<syntaxhighlight lang="lingo">> m=new(#script) |
||
> m.scripttext="on conc(a,b,c)"&RETURN&"return a&c&c&b"&RETURN&"end" |
> m.scripttext="on conc(a,b,c)"&RETURN&"return a&c&c&b"&RETURN&"end" |
||
> put conc("Rosetta", "Code", ":") |
> put conc("Rosetta", "Code", ":") |
||
-- "Rosetta::Code"</ |
-- "Rosetta::Code"</syntaxhighlight> |
||
=={{header|Logo}}== |
=={{header|Logo}}== |
||
{{works with|UCB Logo}} |
{{works with|UCB Logo}} |
||
< |
<syntaxhighlight lang="logo">$ <i>logo</i> |
||
Welcome to Berkeley Logo version 5.6 |
Welcome to Berkeley Logo version 5.6 |
||
? <i>to f :prefix :suffix :separator</i> |
? <i>to f :prefix :suffix :separator</i> |
||
Line 846: | Line 846: | ||
? <i>show f "Rosetta "Code ":</i> |
? <i>show f "Rosetta "Code ":</i> |
||
Rosetta::Code |
Rosetta::Code |
||
?</ |
?</syntaxhighlight> |
||
=={{header|Lua}}== |
=={{header|Lua}}== |
||
< |
<syntaxhighlight lang="lua">$ lua |
||
Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio |
Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio |
||
> function conc(a, b, c) |
> function conc(a, b, c) |
||
Line 856: | Line 856: | ||
> print(conc("Rosetta", "Code", ":")) |
> print(conc("Rosetta", "Code", ":")) |
||
Rosetta::Code |
Rosetta::Code |
||
></ |
></syntaxhighlight> |
||
=={{header|M2000 Interpreter}}== |
=={{header|M2000 Interpreter}}== |
||
Line 872: | Line 872: | ||
</pre > |
</pre > |
||
(we see Function F$() at the header of editor) |
(we see Function F$() at the header of editor) |
||
<syntaxhighlight lang="m2000 interpreter"> |
|||
<lang M2000 Interpreter> |
|||
Read name1$, name2$, sep$ |
Read name1$, name2$, sep$ |
||
=name1$+sep$+sep$+name2$ |
=name1$+sep$+sep$+name2$ |
||
</syntaxhighlight> |
|||
</lang> |
|||
So now we press Esc and return to command line (editor open as a layer, so console has the last state). Using Clipboard we sen unicode string to clipboard |
So now we press Esc and return to command line (editor open as a layer, so console has the last state). Using Clipboard we sen unicode string to clipboard |
||
<pre > |
<pre > |
||
Line 901: | Line 901: | ||
=={{header|M4}}== |
=={{header|M4}}== |
||
Here is a terminal session with output lines marked by "==>": |
Here is a terminal session with output lines marked by "==>": |
||
< |
<syntaxhighlight lang="m4">$ m4 |
||
define(`f',`$1`'$3`'$3`'$2') |
define(`f',`$1`'$3`'$3`'$2') |
||
==> |
==> |
||
f(`Rosetta',`Code',`:') |
f(`Rosetta',`Code',`:') |
||
==>Rosetta::Code |
==>Rosetta::Code |
||
m4exit</ |
m4exit</syntaxhighlight> |
||
=={{header|Maple}}== |
=={{header|Maple}}== |
||
Line 912: | Line 912: | ||
<pre>$ maple</pre> |
<pre>$ maple</pre> |
||
Then enter the Maple commands. |
Then enter the Maple commands. |
||
< |
<syntaxhighlight lang="maple">f := (a,b,c)->cat(a,c,c,b): |
||
f("Rosetta","Code",":");</ |
f("Rosetta","Code",":");</syntaxhighlight> |
||
Output: |
Output: |
||
<pre> "Rosetta::Code"</pre> |
<pre> "Rosetta::Code"</pre> |
||
=={{header|Mathematica}} / {{header|Wolfram Language}}== |
=={{header|Mathematica}} / {{header|Wolfram Language}}== |
||
<lang |
<syntaxhighlight lang="mathematica">$ math</syntaxhighlight> |
||
< |
<syntaxhighlight lang="mathematica">f[x_,y_,z_]:=Print[x,z,z,y] |
||
->"" |
->"" |
||
f["Rosetta","Code",":"] |
f["Rosetta","Code",":"] |
||
->Rosetta::Code</ |
->Rosetta::Code</syntaxhighlight> |
||
=={{header|MATLAB}} / {{header|Octave}}== |
=={{header|MATLAB}} / {{header|Octave}}== |
||
Line 929: | Line 929: | ||
Define an anonymous function in the Command Window |
Define an anonymous function in the Command Window |
||
<syntaxhighlight lang="matlab"> |
|||
<lang Matlab> |
|||
>> f = @(str1, str2, delim) [str1, delim, delim, str2]; |
>> f = @(str1, str2, delim) [str1, delim, delim, str2]; |
||
</syntaxhighlight> |
|||
</lang> |
|||
Call of function and {{out}} |
Call of function and {{out}} |
||
Line 946: | Line 946: | ||
Simply run wxMaxima, xMaxima (or simply maxima in a Linux or Windows command line) to start a REPL. |
Simply run wxMaxima, xMaxima (or simply maxima in a Linux or Windows command line) to start a REPL. |
||
< |
<syntaxhighlight lang="maxima">(%i1) f(a, b, c) := sconcat(a, c, c, b)$ |
||
(%i2) f("Rosetta", "Code", ":"); |
(%i2) f("Rosetta", "Code", ":"); |
||
(%o2) "Rosetta::Code"</ |
(%o2) "Rosetta::Code"</syntaxhighlight> |
||
=={{header|min}}== |
=={{header|min}}== |
||
Run the REPL with <code>min -i</code>, otherwise it'll expect a file to run as a script. |
Run the REPL with <code>min -i</code>, otherwise it'll expect a file to run as a script. |
||
{{works with|min|0.27.1}} |
{{works with|min|0.27.1}} |
||
< |
<syntaxhighlight lang="min">$ (dup suffix swap suffix suffix) :glue |
||
$ "Rosetta" "Code" ":" glue puts! |
$ "Rosetta" "Code" ":" glue puts! |
||
Rosetta::Code |
Rosetta::Code |
||
$</ |
$</syntaxhighlight> |
||
=={{header|ML/I}}== |
=={{header|ML/I}}== |
||
Line 962: | Line 962: | ||
Start ML/I with (e.g.: $ ml1), then type: |
Start ML/I with (e.g.: $ ml1), then type: |
||
< |
<syntaxhighlight lang="ml/i">MCSKIP MT,<> |
||
MCINS %. |
MCINS %. |
||
MCDEF F WITHS (,,) |
MCDEF F WITHS (,,) |
||
AS <%WA1.%WA3.%WA2.%WA2.></ |
AS <%WA1.%WA3.%WA2.%WA2.></syntaxhighlight> |
||
=={{header|Nanoquery}}== |
=={{header|Nanoquery}}== |
||
Line 981: | Line 981: | ||
Run the REPL and paste the following code: |
Run the REPL and paste the following code: |
||
< |
<syntaxhighlight lang="nim">proc f(x, y, z: string) = echo x, z, z, y |
||
f("Rosetta", "Code", ":")</ |
f("Rosetta", "Code", ":")</syntaxhighlight> |
||
which outputs: |
which outputs: |
||
Line 992: | Line 992: | ||
'''File: repl.nim''' |
'''File: repl.nim''' |
||
< |
<syntaxhighlight lang="nim">import ../compiler/[nimeval, llstream] |
||
runRepl(llStreamOpenStdIn().repl, [findNimStdLibCompileTime()], true)</ |
runRepl(llStreamOpenStdIn().repl, [findNimStdLibCompileTime()], true)</syntaxhighlight> |
||
'''Usage''' |
'''Usage''' |
||
<pre>nim c repl.nim |
<pre>nim c repl.nim |
||
Line 1,008: | Line 1,008: | ||
The default interactive interpreter is called the toplevel. In the toplevel because we can enter expressions that span multiple lines, we have to type the double semicolon (";;") at the end of an expression so that it knows we are done. |
The default interactive interpreter is called the toplevel. In the toplevel because we can enter expressions that span multiple lines, we have to type the double semicolon (";;") at the end of an expression so that it knows we are done. |
||
< |
<syntaxhighlight lang="ocaml">$ ocaml |
||
Objective Caml version 3.12.1 |
Objective Caml version 3.12.1 |
||
Line 1,015: | Line 1,015: | ||
# f "Rosetta" "Code" ":";; |
# f "Rosetta" "Code" ":";; |
||
- : string = "Rosetta::Code" |
- : string = "Rosetta::Code" |
||
#</ |
#</syntaxhighlight> |
||
Also a lot of OCaml users invoke the toplevel with rlwrap or ledit to gain readline capabilities: |
Also a lot of OCaml users invoke the toplevel with rlwrap or ledit to gain readline capabilities: |
||
<lang |
<syntaxhighlight lang="ocaml">$ rlwrap ocaml</syntaxhighlight> |
||
There is also [http://benediktmeurer.de/ocamlnat/ ocamlnat] that is a native toplevel. It permits interactive use of the OCaml system through a read-eval-print loop, similar to the standard OCaml toplevel, but up to 100 times faster.<BR> |
There is also [http://benediktmeurer.de/ocamlnat/ ocamlnat] that is a native toplevel. It permits interactive use of the OCaml system through a read-eval-print loop, similar to the standard OCaml toplevel, but up to 100 times faster.<BR> |
||
Line 1,025: | Line 1,025: | ||
=={{header|Octave}}== |
=={{header|Octave}}== |
||
< |
<syntaxhighlight lang="octave">$ octave |
||
GNU Octave, version 3.0.2 |
GNU Octave, version 3.0.2 |
||
Copyright (C) 2008 John W. Eaton and others. |
Copyright (C) 2008 John W. Eaton and others. |
||
Line 1,049: | Line 1,049: | ||
octave:2> concat("Rosetta","Code",":"); |
octave:2> concat("Rosetta","Code",":"); |
||
Rosetta::Code |
Rosetta::Code |
||
octave:3></ |
octave:3></syntaxhighlight> |
||
=={{header|Oforth}}== |
=={{header|Oforth}}== |
||
Line 1,055: | Line 1,055: | ||
Oforth interpreter is started using --i command line parameter : |
Oforth interpreter is started using --i command line parameter : |
||
< |
<syntaxhighlight lang="oforth">oforth --i</syntaxhighlight> |
||
Into the interpreter, you can create functions : |
Into the interpreter, you can create functions : |
||
< |
<syntaxhighlight lang="oforth">: x(a, b, sep) a sep + sep + b + ; |
||
ok |
ok |
||
>x("Rosetta", "Code", ":") |
>x("Rosetta", "Code", ":") |
||
Line 1,066: | Line 1,066: | ||
[1] (String) Rosetta::Code |
[1] (String) Rosetta::Code |
||
ok |
ok |
||
></ |
></syntaxhighlight> |
||
Alternatively you don't need the local variables |
Alternatively you don't need the local variables |
||
< |
<syntaxhighlight lang="oforth"> > : x dup rot + + + ; |
||
ok |
ok |
||
> "Rosetta" "Code" ";" x .s |
> "Rosetta" "Code" ";" x .s |
||
[1] (String) Rosetta::Code |
[1] (String) Rosetta::Code |
||
ok |
ok |
||
> </ |
> </syntaxhighlight> |
||
=={{header|Ol}}== |
=={{header|Ol}}== |
||
Ol comes with builtin REPL. Interactive web-based example can be found at the Ol [https://yuriy-chumak.github.io/ol project page]. |
Ol comes with builtin REPL. Interactive web-based example can be found at the Ol [https://yuriy-chumak.github.io/ol project page]. |
||
< |
<syntaxhighlight lang="scheme"> |
||
$ ol |
$ ol |
||
Welcome to Otus Lisp 2.1-2282-27a9b6c |
Welcome to Otus Lisp 2.1-2282-27a9b6c |
||
Line 1,091: | Line 1,091: | ||
> ,quit |
> ,quit |
||
bye-bye :/ |
bye-bye :/ |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|ooRexx}}== |
=={{header|ooRexx}}== |
||
Line 1,154: | Line 1,154: | ||
Mozart supports this style of programming with its Emacs interface. |
Mozart supports this style of programming with its Emacs interface. |
||
Go to the "Oz" buffer and enter |
Go to the "Oz" buffer and enter |
||
< |
<syntaxhighlight lang="oz">declare fun {F As Bs Sep} {Append As Sep|Sep|Bs} end</syntaxhighlight> |
||
Press C-. C-l to evaluate the line. |
Press C-. C-l to evaluate the line. |
||
Now enter |
Now enter |
||
< |
<syntaxhighlight lang="oz">{System.showInfo {F "Rosetta" "Code" &:}}</syntaxhighlight> |
||
and again press C-. C-l to execute the code. |
and again press C-. C-l to execute the code. |
||
You will see the result in the "*Oz Emulator*" buffer. |
You will see the result in the "*Oz Emulator*" buffer. |
||
Line 1,165: | Line 1,165: | ||
gp *is* a REPL built on the PARI library. You can start it from the command line with <code>gp</code>, though you may wish to change to your Pari directory first so it can read your <code>.gprc</code> file. Alternatively, if you are using a GUI, double-click the shortcut. |
gp *is* a REPL built on the PARI library. You can start it from the command line with <code>gp</code>, though you may wish to change to your Pari directory first so it can read your <code>.gprc</code> file. Alternatively, if you are using a GUI, double-click the shortcut. |
||
< |
<syntaxhighlight lang="parigp">f(s1,s2,sep)=Str(s1, sep, sep, s2);</syntaxhighlight> |
||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
Perl doesn't have an interpreter, but there is an interactive debugger: |
Perl doesn't have an interpreter, but there is an interactive debugger: |
||
< |
<syntaxhighlight lang="perl">$ perl -de1 |
||
Loading DB routines from perl5db.pl version 1.3 |
Loading DB routines from perl5db.pl version 1.3 |
||
Line 1,181: | Line 1,181: | ||
DB<2> p f('Rosetta', 'Code', ':') |
DB<2> p f('Rosetta', 'Code', ':') |
||
Rosetta::Code |
Rosetta::Code |
||
DB<3> q</ |
DB<3> q</syntaxhighlight> |
||
Alternative way: |
Alternative way: |
||
< |
<syntaxhighlight lang="perl">$ perl |
||
# Write the script here and press Ctrl+D plus ENTER when finished (^D means Ctrl+D): |
# Write the script here and press Ctrl+D plus ENTER when finished (^D means Ctrl+D): |
||
sub f {my ($s1, $s2, $sep) = @_; $s1 . $sep . $sep . $s2}; |
sub f {my ($s1, $s2, $sep) = @_; $s1 . $sep . $sep . $s2}; |
||
Line 1,191: | Line 1,191: | ||
^D |
^D |
||
Rosetta::Code |
Rosetta::Code |
||
$</ |
$</syntaxhighlight> |
||
Another: |
Another: |
||
< |
<syntaxhighlight lang="perl">$ perl -lpe '$_=eval||$@' |
||
sub f { join '' => @_[0, 2, 2, 1] } |
sub f { join '' => @_[0, 2, 2, 1] } |
||
f qw/Rosetta Code :/ |
f qw/Rosetta Code :/ |
||
Rosetta::Code</ |
Rosetta::Code</syntaxhighlight> |
||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Line 1,227: | Line 1,227: | ||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |
||
<lang |
<syntaxhighlight lang="bash">$ pil +</syntaxhighlight> |
||
< |
<syntaxhighlight lang="picolisp">: (de f (Str1 Str2 Sep) |
||
(pack Str1 Sep Sep Str2) ) |
(pack Str1 Sep Sep Str2) ) |
||
-> f |
-> f |
||
: (f "Rosetta" "Code" ":") |
: (f "Rosetta" "Code" ":") |
||
-> "Rosetta::Code"</ |
-> "Rosetta::Code"</syntaxhighlight> |
||
=={{header|Pike}}== |
=={{header|Pike}}== |
||
< |
<syntaxhighlight lang="pike">$ pike |
||
Pike v7.8 release 352 running Hilfe v3.5 (Incremental Pike Frontend) |
Pike v7.8 release 352 running Hilfe v3.5 (Incremental Pike Frontend) |
||
> string f(string first, string second, string sep){ |
> string f(string first, string second, string sep){ |
||
Line 1,243: | Line 1,243: | ||
> f("Rosetta","Code",":"); |
> f("Rosetta","Code",":"); |
||
(1) Result: "Rosetta::Code" |
(1) Result: "Rosetta::Code" |
||
></ |
></syntaxhighlight> |
||
=={{header|PowerShell}}== |
=={{header|PowerShell}}== |
||
PowerShell itself is already a shell and therefore an interactive environment is the default. |
PowerShell itself is already a shell and therefore an interactive environment is the default. |
||
< |
<syntaxhighlight lang="powershell">Windows PowerShell |
||
Copyright (C) 2009 Microsoft Corporation. All rights reserved. |
Copyright (C) 2009 Microsoft Corporation. All rights reserved. |
||
Line 1,256: | Line 1,256: | ||
PS Home:\> f 'Rosetta' 'Code' ':' |
PS Home:\> f 'Rosetta' 'Code' ':' |
||
Rosetta::Code |
Rosetta::Code |
||
PS Home:\></ |
PS Home:\></syntaxhighlight> |
||
=={{header|Prolog}}== |
=={{header|Prolog}}== |
||
Line 1,262: | Line 1,262: | ||
Prolog works in its own environnment.<BR> |
Prolog works in its own environnment.<BR> |
||
Start the interpreter by typing pl at the command line (or by clicking on the exe). |
Start the interpreter by typing pl at the command line (or by clicking on the exe). |
||
< |
<syntaxhighlight lang="prolog">% library(win_menu) compiled into win_menu 0.00 sec, 12,872 bytes |
||
% library(swi_hooks) compiled into pce_swi_hooks 0.00 sec, 2,404 bytes |
% library(swi_hooks) compiled into pce_swi_hooks 0.00 sec, 2,404 bytes |
||
% The graphical front-end will be used for subsequent tracing |
% The graphical front-end will be used for subsequent tracing |
||
Line 1,283: | Line 1,283: | ||
3 ?- |
3 ?- |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Python}}== |
=={{header|Python}}== |
||
Start the interpreter by typing python at the command line (or select it from a menu). You get a response showing the version of the interpreter being run before giving an input prompt of three greater-than characters and a space: |
Start the interpreter by typing python at the command line (or select it from a menu). You get a response showing the version of the interpreter being run before giving an input prompt of three greater-than characters and a space: |
||
< |
<syntaxhighlight lang="python">python |
||
Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on |
Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on |
||
win32 |
win32 |
||
Line 1,297: | Line 1,297: | ||
>>> f('Rosetta', 'Code', ':') |
>>> f('Rosetta', 'Code', ':') |
||
'Rosetta::Code' |
'Rosetta::Code' |
||
>>></ |
>>></syntaxhighlight> |
||
=={{header|Quackery}}== |
=={{header|Quackery}}== |
||
Line 1,338: | Line 1,338: | ||
The task: |
The task: |
||
< |
<syntaxhighlight lang="quackery">$ quackery |
||
Welcome to Quackery. |
Welcome to Quackery. |
||
Line 1,359: | Line 1,359: | ||
Stack empty. |
Stack empty. |
||
/O></ |
/O></syntaxhighlight> |
||
=={{header|R}}== |
=={{header|R}}== |
||
< |
<syntaxhighlight lang="r">$ R |
||
R version 2.7.2 (2008-08-25) |
R version 2.7.2 (2008-08-25) |
||
Line 1,386: | Line 1,386: | ||
[1] "Rosetta::Code" |
[1] "Rosetta::Code" |
||
> q() |
> q() |
||
Save workspace image? [y/n/c]: n</ |
Save workspace image? [y/n/c]: n</syntaxhighlight> |
||
=={{header|Racket}}== |
=={{header|Racket}}== |
||
Line 1,392: | Line 1,392: | ||
Much like Scheme, Racket features a full-featured REPL: |
Much like Scheme, Racket features a full-featured REPL: |
||
< |
<syntaxhighlight lang="racket">oiseau:/tmp> racket |
||
Welcome to Racket v5.3.3.5. |
Welcome to Racket v5.3.3.5. |
||
> (define (f string-1 string-2 separator) |
> (define (f string-1 string-2 separator) |
||
Line 1,399: | Line 1,399: | ||
"Rosetta::Code" |
"Rosetta::Code" |
||
> ^D |
> ^D |
||
oiseau:/tmp></ |
oiseau:/tmp></syntaxhighlight> |
||
=={{header|Raku}}== |
=={{header|Raku}}== |
||
(formerly Perl 6) |
(formerly Perl 6) |
||
Using [[Rakudo]]. |
Using [[Rakudo]]. |
||
<lang |
<syntaxhighlight lang="raku" line>$ rakudo/perl6 |
||
> sub f($str1,$str2,$sep) { $str1~$sep x 2~$str2 }; |
> sub f($str1,$str2,$sep) { $str1~$sep x 2~$str2 }; |
||
f |
f |
||
Line 1,410: | Line 1,410: | ||
Rosetta::Code |
Rosetta::Code |
||
> |
> |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|REBOL}}== |
=={{header|REBOL}}== |
||
Start the REBOL/Core interpreter in quiet mode with -q. q to quit. |
Start the REBOL/Core interpreter in quiet mode with -q. q to quit. |
||
< |
<syntaxhighlight lang="rebol">$ rebol -q |
||
>> f: func [a b s] [print rejoin [a s s b]] |
>> f: func [a b s] [print rejoin [a s s b]] |
||
>> f "Rosetta" "Code" ":" |
>> f "Rosetta" "Code" ":" |
||
Rosetta::Code |
Rosetta::Code |
||
>> q</ |
>> q</syntaxhighlight> |
||
=={{header|Retro}}== |
=={{header|Retro}}== |
||
Retro's interpreter is started automatically. Once you see the "ok" prompt, you can proceed to enter code: |
Retro's interpreter is started automatically. Once you see the "ok" prompt, you can proceed to enter code: |
||
< |
<syntaxhighlight lang="retro">:f (sss-s) [ s:prepend ] sip s:prepend s:append ; |
||
'Rosetta 'Code ': f</ |
'Rosetta 'Code ': f</syntaxhighlight> |
||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
===version 1=== |
===version 1=== |
||
< |
<syntaxhighlight lang="rexx">/*REXX*/ parse arg a b c |
||
say f(a,b,c) |
say f(a,b,c) |
||
exit |
exit |
||
f:return arg(1)arg(3)arg(3)arg(2)</ |
f:return arg(1)arg(3)arg(3)arg(2)</syntaxhighlight> |
||
===version 2=== |
===version 2=== |
||
This REXX version allows blanks to be included in the three strings. |
This REXX version allows blanks to be included in the three strings. |
||
< |
<syntaxhighlight lang="rexx">/*REXX program demonstrates interactive programming by using a function [F]. */ |
||
say f('Rosetta', "Code", ':') |
say f('Rosetta', "Code", ':') |
||
say f('The definition of a trivial program is ', " one that has no bugs.", '───') |
say f('The definition of a trivial program is ', " one that has no bugs.", '───') |
||
exit /*stick a fork in it, we're all done. */ |
exit /*stick a fork in it, we're all done. */ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
f: return arg(1) || copies(arg(3),2) || arg(2) /*return the required string to invoker*/</ |
f: return arg(1) || copies(arg(3),2) || arg(2) /*return the required string to invoker*/</syntaxhighlight> |
||
'''output''' when using the (internal) default strings: |
'''output''' when using the (internal) default strings: |
||
<pre> |
<pre> |
||
Line 1,450: | Line 1,450: | ||
===version 3=== |
===version 3=== |
||
This REXX version is more to the keeping of the spirit of the task requirements. |
This REXX version is more to the keeping of the spirit of the task requirements. |
||
< |
<syntaxhighlight lang="rexx">/*REXX program demonstrates interactive programming by using a function [F]. */ |
||
say '══════════════════ enter the function F with three comma-separated arguments:' |
say '══════════════════ enter the function F with three comma-separated arguments:' |
||
parse pull funky |
parse pull funky |
||
Line 1,456: | Line 1,456: | ||
exit /*stick a fork in it, we're all done. */ |
exit /*stick a fork in it, we're all done. */ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
f: return arg(1) || copies(arg(3),2) || arg(2) /*return the required string to invoker*/</ |
f: return arg(1) || copies(arg(3),2) || arg(2) /*return the required string to invoker*/</syntaxhighlight> |
||
'''output''' (a screen scraping is shown) |
'''output''' (a screen scraping is shown) |
||
<br><br>'''int_act3''' is the name of the REXX program [INT_ACT3.REX) |
<br><br>'''int_act3''' is the name of the REXX program [INT_ACT3.REX) |
||
Line 1,473: | Line 1,473: | ||
=={{header|Ring}}== |
=={{header|Ring}}== |
||
< |
<syntaxhighlight lang="ring"> |
||
r = "Rosetta" |
r = "Rosetta" |
||
c = "Code" |
c = "Code" |
||
s = ":" |
s = ":" |
||
see r+s+s+c |
see r+s+s+c |
||
</syntaxhighlight> |
|||
</lang> |
|||
Output: |
Output: |
||
<pre> |
<pre> |
||
Line 1,489: | Line 1,489: | ||
Start the interpreter by typing <code>irb</code> at the command line. You will see an input prompt, which by default is <code>name of this program(name of main object):line number:indent level> </code>: |
Start the interpreter by typing <code>irb</code> at the command line. You will see an input prompt, which by default is <code>name of this program(name of main object):line number:indent level> </code>: |
||
< |
<syntaxhighlight lang="ruby">$ irb |
||
irb(main):001:0> def f(string1, string2, separator) |
irb(main):001:0> def f(string1, string2, separator) |
||
irb(main):002:1> [string1, '', string2].join(separator) |
irb(main):002:1> [string1, '', string2].join(separator) |
||
Line 1,497: | Line 1,497: | ||
=> "Rosetta::Code" |
=> "Rosetta::Code" |
||
irb(main):005:0> exit |
irb(main):005:0> exit |
||
$</ |
$</syntaxhighlight> |
||
=={{header|Rust}}== |
=={{header|Rust}}== |
||
Line 1,503: | Line 1,503: | ||
One of clap configurations is a mathod used a YAML file to build the CLI and keep the Rust source tidy or support multiple localized translations by having different YAML files for each localization. |
One of clap configurations is a mathod used a YAML file to build the CLI and keep the Rust source tidy or support multiple localized translations by having different YAML files for each localization. |
||
- First, create the cli.yaml file to hold the CLI options, but it could be called anything we like: |
- First, create the cli.yaml file to hold the CLI options, but it could be called anything we like: |
||
< |
<syntaxhighlight lang="yaml"> |
||
name: myapp |
name: myapp |
||
version: "1.0" |
version: "1.0" |
||
Line 1,521: | Line 1,521: | ||
required: true |
required: true |
||
index: 3 |
index: 3 |
||
</syntaxhighlight> |
|||
</lang> |
|||
- Then, simply add ''clap'' the ''yaml'' feature flag to your Cargo.toml. |
- Then, simply add ''clap'' the ''yaml'' feature flag to your Cargo.toml. |
||
< |
<syntaxhighlight lang="yaml"> |
||
[dependencies] |
[dependencies] |
||
clap = { version = "3.0.0-beta.2", features = ["yaml"] } |
clap = { version = "3.0.0-beta.2", features = ["yaml"] } |
||
</syntaxhighlight> |
|||
</lang> |
|||
- Enter this code in Rust source file |
- Enter this code in Rust source file |
||
< |
<syntaxhighlight lang="rust"> |
||
#[macro_use] |
#[macro_use] |
||
extern crate clap; |
extern crate clap; |
||
Line 1,547: | Line 1,547: | ||
fn f<'a>(s1: &'a str, s2: &'a str, sep :&'a str) -> String{ |
fn f<'a>(s1: &'a str, s2: &'a str, sep :&'a str) -> String{ |
||
[s1,sep,sep,s2].iter().map(|x| *x).collect() |
[s1,sep,sep,s2].iter().map(|x| *x).collect() |
||
}</ |
}</syntaxhighlight> |
||
Output: |
Output: |
||
<pre> |
<pre> |
||
Line 1,560: | Line 1,560: | ||
Without any arguments it starts from the command-line in [REPL] command-mode: |
Without any arguments it starts from the command-line in [REPL] command-mode: |
||
< |
<syntaxhighlight lang="s-lang">> slsh<Enter> |
||
slsh version 0.9.1-2; S-Lang version: pre2.3.1-23 |
slsh version 0.9.1-2; S-Lang version: pre2.3.1-23 |
||
Copyright (C) 2005-2014 John E. Davis <jed@jedsoft.org> |
Copyright (C) 2005-2014 John E. Davis <jed@jedsoft.org> |
||
Line 1,571: | Line 1,571: | ||
Rosetta::Code |
Rosetta::Code |
||
slsh> quit<Enter> |
slsh> quit<Enter> |
||
> </ |
> </syntaxhighlight> |
||
=={{header|Scala}}== |
=={{header|Scala}}== |
||
Line 1,581: | Line 1,581: | ||
or a batch file depending on one's operating system: |
or a batch file depending on one's operating system: |
||
< |
<syntaxhighlight lang="scala">C:\>scala |
||
Welcome to Scala version 2.8.0.r21356-b20100407020120 (Java HotSpot(TM) Client V |
Welcome to Scala version 2.8.0.r21356-b20100407020120 (Java HotSpot(TM) Client V |
||
M, Java 1.6.0_05). |
M, Java 1.6.0_05). |
||
Line 1,588: | Line 1,588: | ||
scala> "rosetta" |
scala> "rosetta" |
||
res0: java.lang.String = rosetta</ |
res0: java.lang.String = rosetta</syntaxhighlight> |
||
Scala's REPL, starting with version 2.8, offers both auto-completion and alternatives when typing TAB. For instance, to check what methods are available on a String, one |
Scala's REPL, starting with version 2.8, offers both auto-completion and alternatives when typing TAB. For instance, to check what methods are available on a String, one |
||
may do the following: |
may do the following: |
||
< |
<syntaxhighlight lang="scala">scala> "rosetta". |
||
!= ## $asInstanceOf |
!= ## $asInstanceOf |
||
Line 1,612: | Line 1,612: | ||
scala> "rosetta".+(":") |
scala> "rosetta".+(":") |
||
res1: java.lang.String = rosetta:</ |
res1: java.lang.String = rosetta:</syntaxhighlight> |
||
One can use `object`, `class`, `trait`, `case object`, |
One can use `object`, `class`, `trait`, `case object`, |
||
`case class`, `def`, `val` and `var` definitions at any point. However, |
`case class`, `def`, `val` and `var` definitions at any point. However, |
||
`package` and `package object` definitions are not allowed. |
`package` and `package object` definitions are not allowed. |
||
< |
<syntaxhighlight lang="scala">scala> val str1 = "rosetta" |
||
str1: java.lang.String = rosetta</ |
str1: java.lang.String = rosetta</syntaxhighlight> |
||
Using these features, one can build the code for a method by testing it |
Using these features, one can build the code for a method by testing it |
||
part of it individually: |
part of it individually: |
||
< |
<syntaxhighlight lang="scala">scala> val str2 = "code" |
||
str2: java.lang.String = code |
str2: java.lang.String = code |
||
Line 1,627: | Line 1,627: | ||
scala> str1 + separator + str2 |
scala> str1 + separator + str2 |
||
res2: java.lang.String = rosetta:code</ |
res2: java.lang.String = rosetta:code</syntaxhighlight> |
||
If one makes a mistake, the REPL will print an error message, and display the |
If one makes a mistake, the REPL will print an error message, and display the |
||
point at which the mistake was made. |
point at which the mistake was made. |
||
< |
<syntaxhighlight lang="scala">scala> def (str1: String, str2: String, separator: String) = |
||
<console>:1: error: identifier expected but '(' found. |
<console>:1: error: identifier expected but '(' found. |
||
def (str1: String, str2: String, separator: String) = |
def (str1: String, str2: String, separator: String) = |
||
^</ |
^</syntaxhighlight> |
||
If a definition takes more than a line, the REPL will print an indented "|" sign, and |
If a definition takes more than a line, the REPL will print an indented "|" sign, and |
||
wait for more input. If one wishes to abort a definition, just enter two consecutive |
wait for more input. If one wishes to abort a definition, just enter two consecutive |
||
empty lines. |
empty lines. |
||
< |
<syntaxhighlight lang="scala">scala> def f(str1: String, str2: String, separator: String) = |
||
| str1 + separator + str2 |
| str1 + separator + str2 |
||
f: (str1: String,str2: String,separator: String)java.lang.String |
f: (str1: String,str2: String,separator: String)java.lang.String |
||
Line 1,645: | Line 1,645: | ||
scala> f("code", "rosetta", ", ") |
scala> f("code", "rosetta", ", ") |
||
res4: java.lang.String = code, rosetta</ |
res4: java.lang.String = code, rosetta</syntaxhighlight> |
||
Also starting with version 2.8, a line starting with a dot will be interpreted |
Also starting with version 2.8, a line starting with a dot will be interpreted |
||
as a method call on the last result produced. |
as a method call on the last result produced. |
||
< |
<syntaxhighlight lang="scala">scala> .length |
||
res5: Int = 13 |
res5: Int = 13 |
||
scala></ |
scala></syntaxhighlight> |
||
The results are actually displayed with a special function, which pretty prints |
The results are actually displayed with a special function, which pretty prints |
||
some results, and avoid eagerly evaluating others, where that could cause problems |
some results, and avoid eagerly evaluating others, where that could cause problems |
||
(such as infinite collections). |
(such as infinite collections). |
||
< |
<syntaxhighlight lang="scala">scala> Array(1, 2, 3, 4) |
||
res8: Array[Int] = Array(1, 2, 3, 4) |
res8: Array[Int] = Array(1, 2, 3, 4) |
||
scala> println(res8) |
scala> println(res8) |
||
[I@383244</ |
[I@383244</syntaxhighlight> |
||
There are many other features, such as the ability to add new jars to |
There are many other features, such as the ability to add new jars to |
||
the class path, executing commands on the shell, retrieving the last |
the class path, executing commands on the shell, retrieving the last |
||
Line 1,666: | Line 1,666: | ||
=={{header|Scheme}}== |
=={{header|Scheme}}== |
||
Several interpreters exist for Scheme. These are just some examples. |
Several interpreters exist for Scheme. These are just some examples. |
||
<lang>> scheme |
<syntaxhighlight lang="text">> scheme |
||
Scheme Microcode Version 14.9 |
Scheme Microcode Version 14.9 |
||
MIT Scheme running under FreeBSD |
MIT Scheme running under FreeBSD |
||
Line 1,687: | Line 1,687: | ||
End of input stream reached |
End of input stream reached |
||
Happy Happy Joy Joy. |
Happy Happy Joy Joy. |
||
></ |
></syntaxhighlight> |
||
<lang>> scheme48 |
<syntaxhighlight lang="text">> scheme48 |
||
Welcome to Scheme 48 1.8 (made by root on Wed Sep 24 22:37:08 UTC 2008) |
Welcome to Scheme 48 1.8 (made by root on Wed Sep 24 22:37:08 UTC 2008) |
||
Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees. |
Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees. |
||
Line 1,705: | Line 1,705: | ||
I'll only ask another 99 times. |
I'll only ask another 99 times. |
||
Exit Scheme 48 (y/n)? y |
Exit Scheme 48 (y/n)? y |
||
></ |
></syntaxhighlight> |
||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
< |
<syntaxhighlight lang="ruby">$ sidef -i |
||
>>> func f(s1, s2, sep) { s1 + sep*2 + s2 }; |
>>> func f(s1, s2, sep) { s1 + sep*2 + s2 }; |
||
f |
f |
||
>>> f('Rosetta', 'Code', ':') |
>>> f('Rosetta', 'Code', ':') |
||
"Rosetta::Code" |
"Rosetta::Code" |
||
>>> </ |
>>> </syntaxhighlight> |
||
=={{header|Slate}}== |
=={{header|Slate}}== |
||
< |
<syntaxhighlight lang="slate">slate[1]> s@(String traits) rosettaWith: s2@(String traits) and: s3@(String traits) [s ; s3 ; s3 ; s2]. |
||
[rosettaWith:and:] |
[rosettaWith:and:] |
||
slate[2]> 'Rosetta' rosettaWith: 'Code' and: ':'. |
slate[2]> 'Rosetta' rosettaWith: 'Code' and: ':'. |
||
'Rosetta::Code'</ |
'Rosetta::Code'</syntaxhighlight> |
||
=={{header|Smalltalk}}== |
=={{header|Smalltalk}}== |
||
{{works with|GNU Smalltalk}} |
{{works with|GNU Smalltalk}} |
||
< |
<syntaxhighlight lang="smalltalk">$ gst |
||
GNU Smalltalk ready |
GNU Smalltalk ready |
||
Line 1,733: | Line 1,733: | ||
Rosetta::Code |
Rosetta::Code |
||
'Rosetta::Code' |
'Rosetta::Code' |
||
st></ |
st></syntaxhighlight> |
||
{{works with|Smalltalk/X}} |
{{works with|Smalltalk/X}} |
||
< |
<syntaxhighlight lang="smalltalk">$ stx --repl |
||
Welcome... |
Welcome... |
||
Line 1,743: | Line 1,743: | ||
Rosetta::Code |
Rosetta::Code |
||
-> (Answer): 'Rosetta::Code' |
-> (Answer): 'Rosetta::Code' |
||
STX></ |
STX></syntaxhighlight> |
||
=={{header|SNOBOL4}}== |
=={{header|SNOBOL4}}== |
||
Line 1,767: | Line 1,767: | ||
Because you can enter expressions that span multiple lines, you have to type the semicolon (";") at the end so that it knows you are done. |
Because you can enter expressions that span multiple lines, you have to type the semicolon (";") at the end so that it knows you are done. |
||
< |
<syntaxhighlight lang="sml">$ sml |
||
Standard ML of New Jersey v110.67 [built: Fri Jul 4 09:00:58 2008] |
Standard ML of New Jersey v110.67 [built: Fri Jul 4 09:00:58 2008] |
||
- fun f (s1, s2, sep) = String.concatWith sep [s1, "", s2]; |
- fun f (s1, s2, sep) = String.concatWith sep [s1, "", s2]; |
||
Line 1,776: | Line 1,776: | ||
- f ("Rosetta", "Code", ":"); |
- f ("Rosetta", "Code", ":"); |
||
val it = "Rosetta::Code" : string |
val it = "Rosetta::Code" : string |
||
-</ |
-</syntaxhighlight> |
||
=={{header|Tcl}}== |
=={{header|Tcl}}== |
||
< |
<syntaxhighlight lang="tcl">$ tclsh |
||
% proc f {s1 s2 sep} { |
% proc f {s1 s2 sep} { |
||
append result $s1 $sep $sep $s2 |
append result $s1 $sep $sep $s2 |
||
Line 1,785: | Line 1,785: | ||
% f Rosetta Code : |
% f Rosetta Code : |
||
Rosetta::Code |
Rosetta::Code |
||
% exit</ |
% exit</syntaxhighlight> |
||
A simple alternative (one-liners are most convenient in an interactive shell): |
A simple alternative (one-liners are most convenient in an interactive shell): |
||
< |
<syntaxhighlight lang="tcl">$ tclsh |
||
% proc f {a b s} {join [list $a "" $b] $s} |
% proc f {a b s} {join [list $a "" $b] $s} |
||
% f Rosetta Code : |
% f Rosetta Code : |
||
Rosetta::Code |
Rosetta::Code |
||
%</ |
%</syntaxhighlight> |
||
=={{header|TI-89 BASIC}}== |
=={{header|TI-89 BASIC}}== |
||
Line 1,806: | Line 1,806: | ||
=={{header|UNIX Shell}}== |
=={{header|UNIX Shell}}== |
||
{{works with|Bourne Shell}} |
{{works with|Bourne Shell}} |
||
< |
<syntaxhighlight lang="bash">$ sh |
||
sh-3.2$ concat() { echo "$1$3$3$2"; } |
sh-3.2$ concat() { echo "$1$3$3$2"; } |
||
sh-3.2$ concat Rosetta Code : |
sh-3.2$ concat Rosetta Code : |
||
Rosetta::Code |
Rosetta::Code |
||
sh-3.2$</ |
sh-3.2$</syntaxhighlight> |
||
==={{header|C Shell}}=== |
==={{header|C Shell}}=== |
||
< |
<syntaxhighlight lang="csh">$ csh -f |
||
% alias concat 'echo "\!:1\!:3\!:3\!:2"' |
% alias concat 'echo "\!:1\!:3\!:3\!:2"' |
||
% concat Rosetta Code : |
% concat Rosetta Code : |
||
Rosetta::Code |
Rosetta::Code |
||
%</ |
%</syntaxhighlight> |
||
==={{header|es}}=== |
==={{header|es}}=== |
||
< |
<syntaxhighlight lang="es">$ es |
||
; fn concat a b s { result $a$s$s$b } |
; fn concat a b s { result $a$s$s$b } |
||
; echo <={concat Rosetta Code :} |
; echo <={concat Rosetta Code :} |
||
Rosetta::Code |
Rosetta::Code |
||
;</ |
;</syntaxhighlight> |
||
=={{header|Ursa}}== |
=={{header|Ursa}}== |
||
< |
<syntaxhighlight lang="ursa">$ java -jar ursa.jar |
||
cygnus/x ursa v0.76 (default, release 1) |
cygnus/x ursa v0.76 (default, release 1) |
||
[Oracle Corporation JVM 1.8.0_91 on Linux 3.16.0-4-686-pae i386] |
[Oracle Corporation JVM 1.8.0_91 on Linux 3.16.0-4-686-pae i386] |
||
Line 1,835: | Line 1,835: | ||
> out (f "Rosetta" "Code" ":") endl console |
> out (f "Rosetta" "Code" ":") endl console |
||
Rosetta::Code |
Rosetta::Code |
||
> _</ |
> _</syntaxhighlight> |
||
=={{header|Vedit macro language}}== |
=={{header|Vedit macro language}}== |
||
Line 1,842: | Line 1,842: | ||
To define a macro in text register 100: |
To define a macro in text register 100: |
||
< |
<syntaxhighlight lang="vedit">RS(100, "RS(10, @1) RS(10, @3, APPEND) RS(10, @3, APPEND) RS(10, @2, APPEND)")</syntaxhighlight> |
||
To call the macro: |
To call the macro: |
||
< |
<syntaxhighlight lang="vedit">RS(1,"Rosetta") RS(2,"Code") RS(3,":") Call(100) |
||
Message(@10)</ |
Message(@10)</syntaxhighlight> |
||
=={{header|XLISP}}== |
=={{header|XLISP}}== |
||
How to start a REPL depends on the operating system. |
How to start a REPL depends on the operating system. |
||
< |
<syntaxhighlight lang="lisp">XLISP 3.3, September 6, 2002 Copyright (c) 1984-2002, by David Betz |
||
[1] (defun f (a b sep) |
[1] (defun f (a b sep) |
||
(string-append a sep sep b)) |
(string-append a sep sep b)) |
||
Line 1,858: | Line 1,858: | ||
"Rosetta::Code" |
"Rosetta::Code" |
||
[3] </ |
[3] </syntaxhighlight> |
||
=={{header|Wren}}== |
=={{header|Wren}}== |