Instead of eval in the doseq, you could use a macro with a do block,
something like:
user> (defmacro deftags [tags]
`(do ~@(map (fn [tag]
`(defn ~(symbol (str tag "-with"))
[block#] (str ~tag block#)))
tags)))
#'user/deftags
user> (deftags ["html"])
#'user/html-with
user> (html-with [1])
"html[1]"
-Mike
On Thu, Jun 25, 2009 at 11:51 AM, CuppoJava <[email protected]>wrote:
>
> Thanks for the reply.
>
> I use doseq instead of map because I need it to run immediately, and
> I'm not interested in the return values of the functions.
>
> I also would love to be able to simply the (eval ...) part, but I
> don't know of any other way to dynamically define a function in
> Clojure. If you know of a way it'd help me out a lot.
> -Patrick
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---