Anonymous user
Reverse words in a string: Difference between revisions
→{{header|R}}
Line 2,547:
----------------------- Edgar Poe
</pre>
As a dangerous stunt, let's redefine "<tt>{</tt>".
(Everything that happens in R is a function-call.)
<lang R>
> `{` <- function(s) rev(strsplit(s, " ")[[1]])
> {"one two three four five"}
[1] "five" "four" "three" "two" "one"
</lang>
You had better restart your REPL after trying this.
=={{header|Racket}}==
|