Reverse words in a string: Difference between revisions

→‎{{header|Logo}}: Add implementation.
m (J: introduce some whitespace to help J novices with word recognition)
(→‎{{header|Logo}}: Add implementation.)
Line 1,310:
reverse-string poem
</lang>
 
=={{header|Logo}}==
This version just reads the words from standard input.
 
<lang logo>do.until [
make "line readlist
print reverse :line
] [word? :line]
bye</lang>
 
{{Out}}
Given this input: <pre>---------- 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 -----------------------</pre>
it produces this output:
<pre>------------ 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|Lua}}==
1,481

edits