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
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
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
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
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
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
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