2 ms·
This is great, and it is also worth reading "Destructuring in Clojure and Ruby": http://eyeofthesquid.com/blog/2013/09/29/destructing-in-ruby-and-clojure/ http
by lkrubner 12y ago
This is great, and it is also worth reading "Destructuring in Clojure and Ruby":
http://eyeofthesquid.com/blog/2013/09/29/destructing-in-ruby-and-clojure/ http://eyeofthesquid.com/blog/2013/09/29/destructing-in-ruby...
which has some great comparisons. As it says:
"As with many things in Ruby, the better question than “Can it be done this way?” is “Is it wise?”. "
There is a lot that you can do in Ruby that is more gracefully done in Clojure. Brian Carper brings this out even more clearly with his post "Keyword Arguments: Ruby, Clojure, Common Lisp":
http://briancarper.net/blog/579/keyword-arguments-ruby-clojure-common-lisp http://briancarper.net/blog/579/keyword-arguments-ruby-cloju...
That post shows the exact point where keyword arguments in Ruby can become ambiguous, which is the exact moment that Clojure's clarity becomes obvious.
Also, Jay Field's post on the subject of Clojure destructuring is where I got a lot of practical starting ideas (such as using the :keys directive):
http://blog.jayfields.com/2010/07/clojure-destructuring.html http://blog.jayfields.com/2010/07/clojure-destructuring.html