[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[2]: unreadable forms as default in macros
- To: <clisp-list@ma2s2.mathematik.uni-karlsruhe.de>, <clisp-list@ma2s2.mathematik.uni-karlsruhe.de>
- Subject: Re[2]: unreadable forms as default in macros
- From: sshteingold@cctrading.com
- Date: Tue, 30 Sep 97 14:42:53 -0500
- Return-receipt-to: <sshteingold@cctrading.com>
I want it to expand to *readtable*.
It turned out that the right way is (defmacro zz (...) `',rt).
______________________________ Reply Separator _________________________________
Subject: Re: unreadable forms as default in macros
Author: <clisp-list@ma2s2.mathematik.uni-karlsruhe.de> at INET
Date: 1997-09-30 19:13
Sam Steingold <sshteingold@cctrading.com>:
>
> E.g..
> > (defmacro zz (&optional (rt *readtable*)) rt)
> zz
>
> So, what do I do wrong?
When you have problems with macros, it helps to call `macroexpand-1' on
a form, for example:
> (macroexpand-1 '(zz))
#<READTABLE #x0004D0> ;
T
Now, #<READTABLE #x0004D0> is not a valid program according to CLtL1
(neither a symbol, list, number, character nor bit-vector). What do you
want to have (macroexpand-1 '(zz)) to yield?
Either (macroexpand-1 '(zz)) ==> '#<READTABLE #x0004D0>
then (zz) will be the value of *readtable* at macro expansion time
(i.e. maybe compile time).
Or (macroexpand-1 '(zz)) ==> *READTABLE*
then (zz) will be the value of *readtable* at run time.
Bruno