user> (defmacro foo [x]
(let [name# (symbol (str "foo-" x))]
`(defn ~name# [] ())))
#'user/foo
user> (let [eff "gee"] (foo eff))
#'user/foo-eff
On Fri, Jun 3, 2011 at 12:13 AM, Ken Wesson <[email protected]> wrote:
> On Thu, Jun 2, 2011 at 11:07 PM, Daniel Renfer <[email protected]> wrote:
>> You don't need to use eval to create a function dynamically in a macro.
>
> You don't need to use eval to create a function via a macro at compile
> time. But to create a function and intern it in a var whose name is
> not known until run time is quite another matter.
>
> --
> Protege: What is this seething mass of parentheses?!
> Master: Your father's Lisp REPL. This is the language of a true
> hacker. Not as clumsy or random as C++; a language for a more
> civilized age.
>
> --
> 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
--
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