Reverse words in a string: Difference between revisions
Content added Content deleted
(added Factor) |
|||
Line 1,058: | Line 1,058: | ||
</lang> |
</lang> |
||
'''Output''': |
'''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|Factor}}== |
|||
<lang factor>USING: io sequences splitting ; |
|||
IN: rosetta-code.reverse-words |
|||
"---------- 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 -----------------------" |
|||
"\n" split [ " " split reverse " " join ] map [ print ] each</lang> |
|||
{{out}} |
|||
<pre> |
<pre> |
||
------------ Fire and Ice ---------- |
------------ Fire and Ice ---------- |