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 <marko.topol...@gmail.com>wrote:

> 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 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 - Victor
>>
>> On Mon, Feb 18, 2013 at 8:44 PM, Marko Topolnik <marko.t...@gmail.com>wrote:
>>
>>> 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'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.
>>>>
>>>> (->> [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?
>>>>
>>>
>>> as-> is actually a generalization of both -> and ->>: you get to choose
>>> where to involve the previous result in each form. That is why as->> would
>>> be redundant.
>>>
>>> -Marko
>>>
>>>  --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@**googlegroups.com
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en<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+u...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>>
>>>
>>
>>  --
> --
> 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.
>
>
>

-- 
-- 
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.


Reply via email to