>
> It doesn't appear to work for simple cases (where the expressions 
> aren't function calls w/ additional arguments), e.g. (-> 1 inc) 


Thanks for that one. How silly of me :P
Here's a better version of threading.

(defmacro threading [a b x forms]
  (loop [x x
         forms forms]
    (if forms
      (let [form (first forms)
            threaded (if (seq? form)
                       (with-meta
                         `(~(first form)
                           ~`(~a ~`(list ~x ~@(next form)))
                           ~`(~b ~`(list ~x ~@(next form))))
                         (meta form))
                       (list form x))]
        (recur threaded (next forms)))
      x)))



On Friday, August 28, 2015 at 5:30:44 PM UTC+5:30, Moe Aboulkheir wrote:
>
> On Fri, Aug 28, 2015 at 12:37 PM, Akhil Wali <green.tr...@gmail.com 
> <javascript:>> wrote: 
>
> > This does work, but it's a bit of whammy. 
> > Anyone with suggestions for improvement? 
>
> It doesn't appear to work for simple cases (where the expressions 
> aren't function calls w/ additional arguments), e.g. (-> 1 inc) 
>
> Take care, 
> Moe 
>

-- 
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/d/optout.

Reply via email to