Oops , thanks for pointing it out. Sorry Cedric, gotta learn to read more
closely.
On Monday, April 16, 2012 10:22:50 PM UTC-7, Ambrose Bonnaire-Sergeant
wrote:
>
> Compare the number of brackets in Cedric's example to yours.
>
> Ambrose
>
>
>
>>
>> On Monday, April 16, 2012 10:02:48 AM UTC-7, C
On Mon, Apr 16, 2012 at 10:18 PM, larry wrote:
> On Monday, April 16, 2012 10:02:48 AM UTC-7, Cedric Greevey wrote:
>> (-> 3 ((partial f 2))) should also work.
> I just wrote that it DOESN'T WORK. That's the point of the question.I
> should get 5 instead I get
> t#
Hint: (-> 3 ((partial f 2) #_"a
user=> (defn f[x y] (+ x y))
#'user/f
user=> (-> 3 ((partial f 2)))
5
It must works :). Please notice the extra parentheses.
2012/4/17 larry
>
>
> On Monday, April 16, 2012 10:02:48 AM UTC-7, Cedric Greevey wrote:
>>
>> (-> 3 ((partial f 2))) should also work.
>>
>
>
> I just wrote that it DOES
Compare the number of brackets in Cedric's example to yours.
Ambrose
On Tue, Apr 17, 2012 at 1:18 PM, larry wrote:
>
>
> On Monday, April 16, 2012 10:02:48 AM UTC-7, Cedric Greevey wrote:
>>
>> (-> 3 ((partial f 2))) should also work.
>>
>
>
> I just wrote that it DOESN'T WORK. That's the point
On Monday, April 16, 2012 10:02:48 AM UTC-7, Cedric Greevey wrote:
>
> (-> 3 ((partial f 2))) should also work.
>
I just wrote that it DOESN'T WORK. That's the point of the question.I
should get 5 instead I get
t#
--
You received this message because you are subscribed to the Google
Group
(-> 3 ((partial f 2))) should also work.
--
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 unsubsc
Sorry, I meant to link this post:
http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/
On Mon, Apr 16, 2012 at 12:58 PM, Jay Fields wrote:
> 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
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
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 #
But if I first define
(def fp (partial f 2))
then
(-> 3 fp) returns 5 as expected
What's going on ?