They are a logical consequence of the machine. ->> is a mechanical transformation taking a form (->> x (a ... w)) turning it into (a ... w x), and this same mechanical transformation is in place when nested. You example expands in steps like:
(->> a b c (->> d e f)) (->> (b a) c (->> d e f)) (->> (c (b a)) (->> d e f)) (->> d e f (c (b a))) (->> (e d) f (c (b a))) (->> (f (e d)) (c (b a))) (c (b a) (f (e d))) you can see each step in the expansion results come from applying the exact same transformation (this transformation is exactly the ->> macro). this is the natural result of a recursive style of definition. While it is technically possible to change the behavior to what you are suggesting, but it would require special casing ->> and any derivative of ->>. So we could have something that always works the same uniform way, or we could have am ever growing list of special cases. On 03/19/2016 04:57 PM, Arun Sharma wrote: > => (clojure.walk/macroexpand-all '(->> a b c (->> d e f))) > (c (b a) (f (e d))) > > I was hoping that it would return > > (f (e d) (c (b a))) > > Can someone here explain the rationale for the current semantics? > > Context: some of the queries towards the end of this post. > > https://code.facebook.com/posts/1737605303120405/dragon-a-distributed-graph-query-engine/ > > -Arun > > -- > 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 > <mailto:clojure+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout. -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? -- 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.