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

Re[2]: unreadable forms as default in macros



     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