Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpda!hpcupt1!hpcuhb!hpcllla!hpclisp!hpclmao!mao From: mao@hpclmao.HP.COM (Mike Ogush) Newsgroups: comp.lang.lisp Subject: Re: Common Lisp Macro Expander Wanted Message-ID: <640002@hpclmao.HP.COM> Date: 6 Apr 88 18:18:33 GMT References: <49@spar.SPAR.SLB.COM> Organization: HP NSG/ISD Computer Language Lab Lines: 43 / malcolm@spar.SPAR.SLB.COM (Malcolm Slaney) writes: >Can anybody point me towards some code that will take any Common Lisp >expression and macroexpand all of the macros. I would like as output >a s'exp that just has the functions from Steele. I don't think this is too >hard but if somebody else has already done it I would prefer to reuse the >code. (Don't special forms make this non trivial???) > >I want to use this as part of a tool to record storage usage. I'll first >do the necessary macroexpands, then wrap a form around each primitive Common >Lisp form that records the memory usage and then write a tool that will >pretty print the information. > >Thanks for the help. > > Malcolm Slaney > malcolm@spar.slb.com >---------- > When I was learning Common LISP, I wrote just such a function so I could see exactly what s-expressions were being expanded into: (defun fully-expand-macro (exp) (if (consp exp) (let ((car-exp (car exp))) (if (and (symbolp car-exp) (macro-function car-exp)) (fully-expand-macro (macroexpand exp)) (cons car-exp (mapcar #'fully-expand-macro (cdr exp))))) exp) ) Hope this helps Mike Ogush Computer Languages Lab Hewlett-Packard Company ...!hplabs!hpda!mao or mao%hpclmao@hplabs.hp.com