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 [] ...) expression.)
Ben
On Sunday, December 16, 2012, jarppe wrote:
> 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 defined like this:
>
> *(*defn make-greeter []
>
> *(*fn [user-name]
>
> *(*str "Hello, " user-name*)**)**)*
>
>
> I can use it like this:
>
> *(*defgreeter hello*)*
>
> *(*hello "jarppe"*)*
>
> How ever, if I change make-greeter to this I get IllegalArgumentException:
>
> *(*defn make-greeter []
>
> *(*let [message "hello"]
>
> *(*fn [user-name]
>
> *(*str message ", " user-name*)**)**)**)*
>
>
> Interestingly, this does not work either:
>
> *(*defn make-greeter []
>
> *(*constantly "what erver"*)**)*
>
> What am I missing?
>
> --
> -jarppe
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to
> [email protected]<javascript:_e({}, 'cvml',
> '[email protected]');>
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected] <javascript:_e({}, 'cvml',
> 'clojure%[email protected]');>
> 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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en