reading material:
http://blog.fogus.me/2009/09/04/understanding-the-clojure-macro/

When you say (-> 3 (partial f 2)) that evaluates to (partial 3 f 2) -
which is obviously not what you want.

Likewise, (-> 3 fp) expands to (fp 3), which works fine, as you noticed.

The important thing to remember is that the threading operator is a macro.

On Mon, Apr 16, 2012 at 12:53 PM, larry <larrye2...@gmail.com> wrote:
> I trying to grok partial and -> so I have the following example.
>
> (defn f[x y] (+ x y))
>
> ((partial f 2) 3) works as expected , returning 5
>
> but if I try to use ->
>
> (-> 3 (partial f 2))
>
> I get #<core$partial$fn__3796 clojure.core$partial$fn__3796@4c629f43>
>
> But if I first define
>
> (def fp (partial f 2))
>
> then
>
> (-> 3 fp) returns 5 as expected
>
> What's going on ?
>
> --
> 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