One use I've found for -> (though there are others I haven't come to
appreciate yet) is when I have something like:
(f1 (f2 (f3 (f4 x))))

which can be re-written as
(-> x f4 f3 f2 f1)

I find the latter expression easier to read.

Kev

On Dec 30 2008, 2:49 pm, wubbie <sunj...@gmail.com> wrote:
> Very criptic for newbie.
> What  does "Threads the expr through the forms." mean?
> Does it create a thread to execute?
>
> thanks
> sun
>
> On Dec 29, 10:07 pm, Paul Barry <pauljbar...@gmail.com> wrote:
>
> > You can look up the documentation for a function/macro interactively
> > from the repl:
>
> > user=> (doc ->)
> > -------------------------
> > clojure.core/->
> > ([x form] [x form & more])
> > Macro
> >   Threads the expr through the forms. Inserts x as the
> >   second item in the first form, making a list of it if it is not a
> >   list already. If there are more forms, inserts the first form as the
> >   second item in second form, etc.
> > nil
>
> > On Dec 29, 8:27 pm, wubbie <sunj...@gmail.com> wrote:
>
> > > Hi all,
>
> > > Looking intoants.clj, I came across
> > > (defn place [[x y]]
> > >   (-> world (nth x) (nth y)))
>
> > > What -> mean here?
>
> > > thanks
> > > sun
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to