Re: The case for as->> ("as-last")

2013-07-13 Thread Greg
Oh happy day! :-D Today I was looking at some clojure code on using core.async with ClojureScript [1], and the example used this strange "as->" expression that I'd never seen before (I'm from the 1.2 era, just getting back into the Clojure game), and I was trying to figure out what the heck thi

Re: The case for as->> ("as-last")

2013-02-18 Thread Víctor M . V .
Fair enough. Now I'm beggining to truly appreciate as->, thank you. I still believe as->> would be somewhat useful but I don't see it getting added to clojure.core now. On Mon, Feb 18, 2013 at 9:10 PM, Marko Topolnik wrote: > as-> is meant to be used as the only threading form. In your example yo

Re: The case for as->> ("as-last")

2013-02-18 Thread Marko Topolnik
as-> is meant to be used as the only threading form. In your example you'd want to replace the initial ->> with as->. On Monday, February 18, 2013 9:04:55 PM UTC+1, vemv wrote: > > That extra parenses trick is neat, never thought of that! > > As for as->> being redundant - it could be considered

Re: The case for as->> ("as-last")

2013-02-18 Thread Víctor M . V .
That extra parenses trick is neat, never thought of that! As for as->> being redundant - it could be considered so indeed, given that as-> can be lambified: (->> [] (#(as-> % x (map inc x - but that's pretty damn ugly haha. If you were thinking something else, please let me know. Thanks - Vic

Re: The case for as->> ("as-last")

2013-02-18 Thread Marko Topolnik
On Monday, February 18, 2013 5:40:51 PM UTC+1, vemv wrote: > > And neither can be solved by adding a lambda: > > (-> [[1 1 1] 2 3] (nth 0) #(map inc %)) ;; fail > Lambda does solve it, you are just missing the parens around the lambda: (-> [[1 1 1] 2 3] (nth 0) (#(map inc %))) > Clojure 1.5'

The case for as->> ("as-last")

2013-02-18 Thread vemv
While there are other possible uses (example), 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 th