in reply to Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell)
#!/usr/bin/tclsh proc reversewords {str} { proc rev {a b} {return 1} return [join [lsort -command rev [regexp -all -inline -- {\S+} $st +r]]] } puts "<<[reversewords { one two three four }]>>"
|
---|