On 19/07/2011, at 11:47 AM, Sean Corfield wrote: > On Mon, Jul 18, 2011 at 5:41 PM, Andreas Kostler > <andreas.koestler.le...@gmail.com> wrote: >> Ups, I'm not aware of that thread...I just found a more general threading >> operator handy sometimes. >> I do kinda agree that we shouldn't necessarily encourage threading in >> arbitrary positions. >> However, I can't quite follow your second argument. >> While it does mean two different things, I don't see the problem with that. >> We could use _ instead of :? to indicate we don't care about the 'meaning'. > > But _ means "don't care" by convention in Clojure, for values that are > ignored... > > The issue is about bindings and immutability: foo should mean the same > value throughout an expression - that's kind of fundamental to Clojure > (IMO). With your macro (and the previous examples introduced by > others), some arbitrary symbol changes its meaning in each consecutive > form without any marker for lexical or dynamic binding... so it's > behaving like a mutable iterator or loop variable :( I agree with that, however, :? or _ or whatever doesn't bind to anything. It merely gets replaced. -> already does this in a hidden way...e.g. there's no symbol but the meaning of 'first argument' changes in each consecutive form. > > With only a couple more characters you can already do what you need > without a new macro: > > (-> "x" > (#(str "y" % "z")) > (#(str "a" % "b")) > println) Here, the meaning of % changes?!?
> > There's also the possibility of mixing -> and ->> to splice in first > arg / last arg threading. There was a great blog post about this > recently but I can't find it (-> and ->> are remarkably hard to search > for on Google!)... I agree :) > -- > Sean A Corfield -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ > World Singles, LLC. -- http://worldsingles.com/ > Railo Technologies, Inc. -- http://www.getrailo.com/ > > "Perfection is the enemy of the good." > -- Gustave Flaubert, French realist novelist (1821-1880) > > -- > 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 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