[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unreadable forms as default in macros



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