Reverse words in a string: Difference between revisions

Added Easylang
(→‎{{header|BQN}}: Array-oriented version)
(Added Easylang)
 
(4 intermediate revisions by 3 users not shown)
Line 1,132:
end.</syntaxhighlight>
The output is the same as the Pascal entry.
 
=={{header|EasyLang}}==
<syntaxhighlight>
repeat
s$ = input
until error = 1
s$[] = strsplit s$ " "
for i = len s$[] downto 1
write s$[i] & " "
.
print ""
.
input_data
--------- Ice and Fire ------------
fire, in end will world the say Some
ice. in say Some
desire of tasted I've what From
fire. favor who those with hold I
... elided paragraph last ...
Frost Robert -----------------------
</syntaxhighlight>
 
=={{header|EchoLisp}}==
Line 1,168 ⟶ 1,192:
 
=={{header|Elena}}==
ELENA 56.0x:
<syntaxhighlight lang="elena">import extensions;
import system'routines;
Line 1,185 ⟶ 1,209:
"Frost Robert -----------------------"};
text.forEach::(line)
{
line.splitBy:(" ").sequenceReverse().forEach::(word)
{
console.print(word," ")
Line 3,502 ⟶ 3,526:
----------------------- Robert Frost
</syntaxhighlight>
 
=={{header|RPL}}==
« { }
'''WHILE''' OVER " " POS '''REPEAT'''
LASTARG → sep
« OVER 1 sep SUB +
SWAP sep 1 + OVER SIZE SUB SWAP
»
'''END'''
SWAP + REVLIST
'''IFERR''' ∑LIST '''THEN''' 1 GET '''END'''
» '<span style="color:blue">REVWORDS</span>' STO
{ "---------- Ice and Fire ------------" "" "fire, in end will world the say Some" "ice. in say Some" "desire of tasted I've what From" "fire. favor who those with hold I" "" "... elided paragraph last ..." "" "Frost Robert -----------------------" }
1 « <span style="color:blue">REVWORDS</span> » DOLIST
 
{{out}}
<pre>
1: { "------------ Fire and Ice ----------"
""
"Some say the world will end in fire,"
"Some say in ice."
"From what I've tasted of desire"
"I hold with those who favor fire."
""
"... last paragraph elided ..."
""
"----------------------- Robert Frost" }
</pre>
 
=={{header|Ruby}}==
Line 4,166 ⟶ 4,219:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">var lines = [
"---------- Ice and Fire ------------",
" ",
2,022

edits