Re: macro expansion time

2009-04-20 Thread Konrad Hinsen
On 21.04.2009, at 00:26, Mark Volkmann wrote: > Is it correct to say that macros are expanded at read-time? No. Only reader macros are expanded at read time, standard macros are expanded at compile time. A more subtle point concerns the distinction between compile time and run time, because

Re: macro expansion time

2009-04-20 Thread Laurent PETIT
But "reader macros" *are* expanded at read-time (as their name indicates, BTW) : 1:91 user=> (read-string "'quoted-symbol") (quote quoted-symbol) 1:92 user=> HTH, -- Laurent 2009/4/21 Laurent PETIT : > 2009/4/21 Mark Volkmann : >> >> I didn't explain my question well enough. Suppose I define

Re: macro expansion time

2009-04-20 Thread Laurent PETIT
2009/4/21 Mark Volkmann : > > I didn't explain my question well enough. Suppose I define a macro > with defmacro and have several calls to it in my code. When are those > calls expanded to the code inside the macro? Is that at read-time? Maybe the example I gave (by using the macro 'defn) was not

Re: macro expansion time

2009-04-20 Thread Meikel Brandmeyer
Hi Mark, Am 21.04.2009 um 00:40 schrieb Mark Volkmann: I didn't explain my question well enough. Suppose I define a macro with defmacro and have several calls to it in my code. When are those calls expanded to the code inside the macro? Is that at read-time? As Laurent said: No. Macro expansi

Re: macro expansion time

2009-04-20 Thread Mark Volkmann
I didn't explain my question well enough. Suppose I define a macro with defmacro and have several calls to it in my code. When are those calls expanded to the code inside the macro? Is that at read-time? On Mon, Apr 20, 2009 at 5:34 PM, Laurent PETIT wrote: > > Hello, > > Apparently, no: > > 1:8

Re: macro expansion time

2009-04-20 Thread Laurent PETIT
Hello, Apparently, no: 1:85 user=> (macroexpand-1 '(defn hello [] "world")) (def hello (clojure.core/fn ([] "world"))) 1:86 user=> (read-string "(defn hello [] \"world\")") (defn hello [] "world") 1:87 user=> read-string did not expand defn. I think it's 'eval that expands macros and compiles

macro expansion time

2009-04-20 Thread Mark Volkmann
In my Clojure article at http://ociweb.com/mark/clojure/article.html I say: "Clojure code is processed in three phases: read-time, compile-time and run-time. At read-time the Reader reads source code and converts it to a data structure, mostly a list of lists of lists At compile-time this da