Re: question about partial

2012-04-17 Thread larry
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

Re: question about partial

2012-04-16 Thread Sean Corfield
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

Re: question about partial

2012-04-16 Thread dennis zhuang
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

Re: question about partial

2012-04-16 Thread Ambrose Bonnaire-Sergeant
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

Re: question about partial

2012-04-16 Thread 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 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

Re: question about partial

2012-04-16 Thread Cedric Greevey
(-> 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

Re: question about partial

2012-04-16 Thread Jay Fields
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

Re: question about partial

2012-04-16 Thread Jay Fields
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

question about partial

2012-04-16 Thread larry
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 ?