On Fri, Aug 28, 2015 at 12:37 PM, Akhil Wali <green.transis...@gmail.com> wrote:
> > This does work, but it's a bit of whammy. > Anyone with suggestions for improvement? > I went over this quickly, though it seems to work OK: (defn threading [x first? forms] (reduce (fn [x form] (if (seq? form) (let [[op & args] form args (conj (cond-> args (not first?) vec) x)] (apply list op args)) (list form x))) x forms)) (defmacro -> [x & forms] (threading x true forms)) (defmacro ->> [x & forms] (threading x false forms)) 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.