While there are other possible uses (example<https://twitter.com/borkdude/status/302881431649128448>), I see myself mainly using as-> as a mechanism for resorting to thread-last within a thread-first expression.
For example, given (-> [[1 1 1] 2 3] (nth 0)) I might want to add an operation that doesn't happen to have an adequate signature (sequence functions tend to not be thread-first friendly). You can't just add: (-> [[1 1 1] 2 3] (nth 0) (map inc)) ;; fail And neither can be solved by adding a lambda: (-> [[1 1 1] 2 3] (nth 0) #(map inc %)) ;; fail Clojure 1.5's as->, though, can come to the rescue. (-> [[1 1 1] 2 3] (nth 0) (as-> x (map inc x))) ;; cool Now, I only wish 1.5 came with as->> macro! Its implemetation is trivial anyway. (defmacro as->> [name & body] (let [[b v] ((juxt butlast last) body)] `(let [~name ~v] ~@b))) (->> [1 2 3] (as->> _ (nth _ 0))) Of course, for the given examples, using these "as" forms is overkill. But if you've ever ended up writing large expressions (especially when experimenting) which arbitrarily nest/interleave ->> and ->, using as-> and as->> can provide a more sequential, structured alternative. Couldn't find any related discussion about the uses of as->, as its name is unfriendly to Google/JIRA searches. Thoughts? -- -- 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/groups/opt_out.