Good question. I've been rooting around arrow land for the past few days.

*some->* , now a part of clojure.core, was originally in core.incubator as
*-?>*. From the documentation, it's the *same as clojure.core/-> but
returns nil as soon as the threaded value is nil itself (thus
short-circuiting any pending computation)*. So for example:

(some-> "foo" .toUpperCase)
"FOO"

(some-> "foo" .toUpperCase (.substring 1))
"OO"


*as->* was introduced in 1.5, as part of a bunch of new threading
macros<https://github.com/clojure/clojure/blob/master/changes.md#24-new-threading-macros>.
It *binds name to expr, evaluates the first form in the lexical context of
that binding, then binds name to that result, repeating for each successive
form*.The example they give is below.

user=> (-> 84
           (/ 4)
           (as-> twenty-one          ;; uses the value from ->
                  (* 2 twenty-one)))  ;; no threading here
42


Here's a few more arrow resources.

   - LonoCloud/synthread <https://github.com/LonoCloud/synthread>
   - rplevy/swiss-arrows <https://github.com/rplevy/swiss-arrows>
   - clojure/core.incubator <https://github.com/clojure/core.incubator>
   - Build An Arrow ← <http://www.clojure.net/2013/10/16/Build-an-arrow/>



Hth

Tim Washington
Interruptsoftware.com <http://interruptsoftware.com>



On Mon, Apr 7, 2014 at 10:02 PM, Plínio Balduino <pbaldu...@gmail.com>wrote:

> Hi there
>
> It's being hard to find updated documentation with 1.5+ features and I'm
> confused about as-> and some->.
>
> Basically, what's the difference between the contrib -?> and the core
> some-> ?
>
> Thank you
>
> Plínio
>

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

Reply via email to