Requests for a "more general" threading macro are usually met with a link to the thread where Rich says this is not needed and we should not encourage functions that need threading anywhere except the first or last position. I don't have the link handy (sorry).
The usual objection centers around the fact that whatever symbol is used for the binding position then becomes a "varying" thing within the expression: (-newthread-> "x" (str "y" :? "z") (str "a" :? "b") println) Here :? means two different things which seems counter to how Clojure works elsewhere... Sean On Mon, Jul 18, 2011 at 5:10 PM, Andreas Kostler <andreas.koestler.le...@gmail.com> wrote: > Maybe you might find this useful > > (defmacro -> > ([x] x) > ([x form] (if (seq? form) > (with-meta (replace {:? x} form) (meta form)) > (list form x))) > ([x form & more] `(-> (-> ~x ~form) ~@more))) > > This allows for a more flexible threading operation: > > user> (-> "c" > (third-param "a" "b" :? "d") > println) > first a second b third c fourth d > nil > > Cheers > Andreas -- 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