Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Marko Topolnik
On Mon, Dec 17, 2012 at 11:08 AM, Alex Baranosky > wrote: > Function values can't be read by the reader. I'm not sure how any >> versions of this code work. >> >> > It is true that a function value can not be printed and then read back in, > but I don't think that's relevant here. The macro

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Ben Smith-Mannschott
On Mon, Dec 17, 2012 at 11:08 AM, Alex Baranosky < alexander.barano...@gmail.com> wrote: > Function values can't be read by the reader. I'm not sure how any > versions of this code work. > > It is true that a function value can not be printed and then read back in, but I don't think that's releva

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Alex Baranosky
Function values can't be read by the reader. I'm not sure how any versions of this code work. On Mon, Dec 17, 2012 at 12:32 AM, Marko Topolnik wrote: > On Monday, December 17, 2012 9:28:20 AM UTC+1, bsmith.occs wrote: > >> Your macro: >> >> *(*~greeter user-name#*)* >> >> * >> * >> >> I

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Marko Topolnik
On Monday, December 17, 2012 9:28:20 AM UTC+1, bsmith.occs wrote: > Your macro: > > *(*~greeter user-name#*)* > > * > * > > Is producing a list of a function or closure followed by a symbol. The > first element of the list your macro builds must instead be an expression > that can be ev

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Ben Smith-Mannschott
Your macro: *(*~greeter user-name#*)* * * Is producing a list of a function or closure followed by a symbol. The first element of the list your macro builds must instead be an expression that can be evaluated to a function. (For example a symbol naming a function or an (fn [] ...) expre

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread jarppe
On Sunday, December 16, 2012 9:57:26 PM UTC+2, Jonathan Fischer Friberg wrote: > > I don't know why it doesn't work. However, changing defgreeter to the > following seems work. > > (defmacro defgreeter [greeter-name] > (let [greeter (make-greeter)] > `(def ~greeter-name ~greeter))) > >

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-16 Thread jarppe
I think you are right, when ever the function returns a closure I get the exception. I think it should work with closures anyhow. -- -jarppe On Sunday, December 16, 2012 7:49:30 PM UTC+2, juan.facorro wrote: > > I think it has to do with the closure in the *fn *used when generating > the form

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-16 Thread Jonathan Fischer Friberg
I don't know why it doesn't work. However, changing defgreeter to the following seems work. (defmacro defgreeter [greeter-name] (let [greeter (make-greeter)] `(def ~greeter-name ~greeter))) Might be a clue. :) Jonathan On Sun, Dec 16, 2012 at 6:49 PM, juan.facorro wrote: > I think it ha

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-16 Thread juan.facorro
I think it has to do with the closure in the *fn *used when generating the form in the macro. If you change this function: *(defn make-greeter []* * (let [message "hello"]* *(fn [user-name]* * (str message ", " user-name* To this one: *(defn make-greeter [] * * (fn [user-name]*

Why I get IllegalArgumentException: No matching ctor found

2012-12-16 Thread jarppe
Hi, I have this macro (complete file https://www.refheap.com/paste/7633): *(*defmacro defgreeter [greeter-name] *(*let [greeter *(*make-greeter*)*] `*(*do *(*defn ~greeter-name [user-name#] *(*~greeter user-name#*)**)**)**)**)* It works as expected when make-greeter is