eliot@phoenix.Princeton.EDU (Eliot Handelman) (11/14/90)
I need a function that macroexpands locally-defined macros (via MACROLET) -- is there some way to do this in plain CL? If not, has anyone hacked such a tool in KCL? Am I right in thinking that the optional environment to MACROEXPAND is the way to go? Can the PCL portable code-walker be used to do this? If so, how? Thank you, and have a nice day. --eliot
maverick@fir.Berkeley.EDU (Vance Maverick) (11/15/90)
In article <4049@idunno.Princeton.EDU>, eliot@phoenix.Princeton.EDU (Eliot Handelman) writes: > I need a function that macroexpands locally-defined macros (via MACROLET) > -- is there some way to do this in plain CL? If not, has anyone hacked such a > tool in KCL? Am I right in thinking that the optional environment to > MACROEXPAND is the way to go? Yes, according to CLtL. But how do you get the Lisp object representing an environment?
moore%cdr.utah.edu@cs.utah.edu (Tim Moore) (11/15/90)
In article <8880@pasteur.Berkeley.EDU> maverick@fir.Berkeley.EDU (Vance Maverick) writes: >In article <4049@idunno.Princeton.EDU>, eliot@phoenix.Princeton.EDU >(Eliot Handelman) writes: >> I need a function that macroexpands locally-defined macros (via MACROLET) >> -- is there some way to do this in plain CL? If not, has anyone hacked >such a >> tool in KCL? Am I right in thinking that the optional environment to >> MACROEXPAND is the way to go? > >Yes, according to CLtL. But how do you get the Lisp object representing >an environment? By using the &environment argument to macros. Tim Moore moore@cs.utah.edu {bellcore,hplabs}!utah-cs!moore "Ah, youth. Ah, statute of limitations." -John Waters
eliot@phoenix.Princeton.EDU (Eliot Handelman) (11/15/90)
In article <1990Nov14.135322.7677@hellgate.utah.edu> moore%cdr.utah.edu@cs.utah.edu (Tim Moore) writes: ;In article <8880@pasteur.Berkeley.EDU> maverick@fir.Berkeley.EDU (Vance Maverick) writes: ;>In article <4049@idunno.Princeton.EDU>, eliot@phoenix.Princeton.EDU ;>(Eliot Handelman) writes: ;>> I need a function that macroexpands locally-defined macros (via MACROLET) ;>> -- is there some way to do this in plain CL? If not, has anyone hacked ;>such a ;>> tool in KCL? Am I right in thinking that the optional environment to ;>> MACROEXPAND is the way to go? ;> ;>Yes, according to CLtL. But how do you get the Lisp object representing ;>an environment? ; ;By using the &environment argument to macros. In answer to my own question, a function containing macrolets can be expanded using the pcl portable code walker like this (as pointed out to me by Chris Richardson of Franz): (pcl::walk-form form)
gregor@parc.xerox.com (Gregor Kiczales) (11/17/90)
As someone else mentioned, you want to use the CL code walker distributed with PCL. You can FTP all of PCL from arisia.xerox.com. It is in the /pcl directory. The file you really want is walk.lisp, and there is some documentation there about how to use it. In a recent (I forget which) issue of Lisp Pointers, Pavel Curtis wrote had an article describing the issues involved in walking CL code, and how (a conceptually cleaned up) version of the PCL code walker worked.