Reverse words
Write a function that takes a string containing words (one or more sentences) and returns a string containing the words in reverse order.
Examples
(reverse-words "my name is Eric.") ;;=> "Eric. is my name"
(reverse-words "hello") ;;=> "hello"
(reverse-words "I love you") ;;=> "you love I"
Note: Words are characters separated by whitespace.
Thanks to this site for the problem idea, where it is rated Very Hard in Java. The problem has been modified.
Please submit your solutions as comments on this gist.
To subscribe: https://ericnormand.me/newsletter
I'm new to Eric and relatively new to clojure, this being my first exercise all around as a recent subscriber. Also new to github. But hey, took my best shot. Figured my submission was lazy at best but wanted to ante up. Good to know 'reverse' is less efficient, though like normalizing a database maybe sometimes designing with redundancy / inefficiency ends up being a net-positive for readability / accessibility given the power available these days? Still a slippery slope, no doubt. End of a day - better and more simplified, elegant code seems the best way to sleep at night. Fun lil community. Thanks for having me! -Matthew Leach, VT