As a nice result of this, you can easily see what the problem is
simply by quoting the form: this resolves reader macros but leaves the
form otherwise unevaluated, so you can determine what forms the ->
macro is working with:

user> '(-> x #(inc %))
(-> x (fn* [p1__4781#] (inc p1__4781#)))
user> (macroexpand '(-> x #(inc %)))
(fn* x [p1__4788#] (inc p1__4788#))


On Nov 3, 5:52 am, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> 2011/11/2 Stefan Kamphausen <ska2...@googlemail.com>:
>
> > Hi,
>
> > while all the other answers already offered explanations and solutions I
> > feel like I should add, that macros like -> and ->> work on the
> > source-code.
>
> Not quite. Macros work on Clojure data structures returned by the
> Clojure Reader (so reader-macros have already done their job at this
> point).
>
>
>
>
>
>
>
> > So using -> does not mean 'pass the first thing as an argument
> > to the function call in the second thing', it means 'take the first thing
> > and rearrange my source-code so that the second thing becomes a list with
> > the first thing in the second position'.  And all this is done before
> > compiling.
>
> > Hope that helps.
>
> > Kind regards,
> > Stefan
>
> > --
> > 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 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

Reply via email to