Reverse words in a string: Difference between revisions

Content added Content deleted
(Add SenseTalk implementation)
(Realize in F#)
Line 1,169: Line 1,169:
</pre>
</pre>


=={{header|F_Sharp|F#}}==
<lang fsharp>
//Reverse words in a string. Nigel Galloway: July 14th., 2021
[" ---------- Ice and Fire ------------ ";
" ";
" fire, in end will world the say Some ";
" ice. in say Some ";
" desire of tasted I've what From ";
" fire. favour who those with hold I ";
" ";
" ... elided paragraph last ... ";
" ";
" Frost Robert ----------------------- "]|>List.map(fun n->n.Split " "|>Array.filter((<>)"")|>Array.rev|>String.concat " ")|>List.iter(printfn "%s")
</lang>
{{out}}
<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 favour fire.

... last paragraph elided ...

----------------------- Robert Frost
</pre>
=={{header|Factor}}==
=={{header|Factor}}==
<lang factor>USING: io sequences splitting ;
<lang factor>USING: io sequences splitting ;