On July 19, 2013 at 11:28:50 AM, Daniel Dinnyes (dinny...@gmail.com) wrote:
Oh, and the implementation is clean and simple. Just cleaned it up a bit from 
all the clutter:

;;; The DUH..IT'S SO SIMPLE! macro
(defmacro duh->
  ([x alias form]
     `(let [~alias ~x] ~form))
  ([x alias form & more]
     `(duh-> (duh-> ~x ~alias ~form) ~@more)))

This gives YOU the full power of destructuring and threading through functions 
with ANY parameter order. Full `let` power! Why not use let then? True, the 
only difference is the restriction to a single thread of bindings, not allowing 
for mixing things up. As David Nolen points out below though, that is a HUGE 
benefit, the reason why all the threading macros exist. Beside that 
restriction, this fine macro above won't struggle to take away any of the `let` 
goodies, unlike ->, ->>, as->, or anything.
I understood David's comment differently, that the current threading macros 
exist so that explicit bindings for each threaded form are not needed for they 
very specific cases they intend to simplify. I'm not saying your macro is dumb, 
I just don't find the sugar particularly tasty. ;-)

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to