Re: def in caller namespace from a macro

2008-12-19 Thread Meikel Brandmeyer
Hi, Am 19.12.2008 um 21:25 schrieb John D. Hume: (ns foo) (defmacro defthing [s] (let [thing-name 'thing] `(def ~thing-name (format "the %s thing" ~s Simply put 'thing directly into the syntax-quote: (defmacro defthing [s] `(def ~'thing (format "the %s thing" ~s))) But be sure to

def in caller namespace from a macro

2008-12-19 Thread John D. Hume
I'm learning macros, and I've figured something out that works for what I want to do but looks awfully weird. Is this a hacky mess because I don't know the clean way to do it or an idiom I just need to get used to? I want a macro expansion to define some functions in the namespace of the "caller.