in reply to Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell)
Fun thread! Here it is in R :
reverseWords <- function(words) { return( sort( words, decreasing=TRUE)) }
Updated:
Fixed now. Thanks to jdporter for catching a goof.
reverseWords <- function(words) { return( paste( rev( unlist( strsplit( words, split=" "))), sep=" ", +collapse=" ")) }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Five Ways to Reverse a String of Words (C#, Perl 5, Perl6, Ruby, Haskell)
by jdporter (Paladin) on Dec 12, 2006 at 21:16 UTC | |
by moklevat (Priest) on Dec 13, 2006 at 16:59 UTC | |
by jbullock35 (Hermit) on Dec 13, 2006 at 09:45 UTC |
In Section
Meditations