Reverse a string: Difference between revisions
m
→{{header|Oberon}}: Fixed language name
(→{{header|BASIC}}: Sort entries; add Commodore BASIC 3.5+ implementation) |
m (→{{header|Oberon}}: Fixed language name) |
||
(13 intermediate revisions by 9 users not shown) | |||
Line 748:
<syntaxhighlight lang="befunge">55+~>:48>*#8\#4`#:!#<#~_$>:#,_@</syntaxhighlight>
=={{header|Binary Lambda Calculus}}==
This 9 byte program, featured on https://www.ioccc.org/2012/tromp/hint.html, reverses its input in byte-oriented BLC:
<pre>16 46 80 17 3e f0 b7 b0 40</pre>
=={{header|BQN}}==
Line 1,379 ⟶ 1,385:
=={{header|Elm}}==
<syntaxhighlight lang="elm">
import String exposing (reverse) ▼
▲import Html exposing (Html, Attribute, text, div, input)
change myText =
text ("reverse " ++ myText
++ " = " ++ String.reverse myText)
div []▼
main =
div [style "margin" "5%", style "font-size" "1.5em"]
[change "as⃝da"
, p []
,
▲ ]</syntaxhighlight>
Link to live demo:
{{out}}
<pre>
reverse as⃝da = ad⃝sa
reverse a⃝su-as⃝u = u⃝sa-us⃝a
reverse Hello! = !olleH
</pre>
=={{header|Emacs Lisp}}==
Line 1,724 ⟶ 1,715:
<syntaxhighlight lang="clojure">
!dlrow olleH
</syntaxhighlight>
=={{header|Fennel}}==
Uses the same methods (and suffers from the same limitations) as [[#Lua|the Lua example]].
<syntaxhighlight lang="fennel">
(let [example :asdf]
(string.reverse example) ; fdsa
(example:reverse) ; fdsa
nil)
</syntaxhighlight>
Line 2,382:
=={{header|langur}}==
<syntaxhighlight lang="langur">writeln
{{out}}
Line 3,026:
60 PRINT REVERSED$</syntaxhighlight>
=={{header|Oberon-2}}==
Tested with [https://miasap.se/obnc OBNC].
<syntaxhighlight lang="oberon">MODULE reverse;
Line 3,849:
<syntaxhighlight lang="red">>> reverse "asdf"
== "fdsa"</syntaxhighlight>
=={{header|Refal}}==
<syntaxhighlight lang="refal">$ENTRY Go {
= <Prout <Reverse 'asdf'>>;
};
Reverse {
(e.X) = e.X;
(e.X) s.C e.Y = <Reverse (s.C e.X) e.Y>;
e.X = <Reverse () e.X>;
};</syntaxhighlight>
{{out}}
<pre>fdsa</pre>
=={{header|ReScript}}==
Line 3,963 ⟶ 3,976:
=={{header|RPL}}==
{{works with|Halcyon Calc|4.2.7}}
≪
OVER j DUP SUB +
-1 '''STEP''' SWAP DROP
≫ '<span style="color:blue">RVSTR</span>' STO
"ABC" <span style="color:blue">RVSTR</span>
{{out}}
<pre>1: "CBA"</pre>
Line 4,310 ⟶ 4,325:
. di ustrreverse(s)
νῆγ νὴτ ὶακ νὸναρὐο νὸτ ςὸεθ ὁ νεσηίοπἐ ῇχρἀ νἘ</syntaxhighlight>
=={{header|Stringle}}==
This inputs a string from the user and outputs its reverse. The <code>\</code> ''reverse'' operator reverses any string.
<syntaxhighlight lang="stringle">$ \$</syntaxhighlight>
=={{header|Swift}}==
Line 4,725 ⟶ 4,745:
{{libheader|Wren-str}}
{{libheader|Wren-upc}}
<syntaxhighlight lang="
import "./upc" for Graphemes
for (word in ["asdf", "josé", "møøse", "was it a car or a cat I saw", "😀🚂🦊"]) {
|