Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!rutgers!njin!princeton!phoenix!eliot From: eliot@phoenix.Princeton.EDU (Eliot Handelman) Newsgroups: comp.lang.lisp Subject: Re: Question about Macros (Common Lisp) Message-ID: <13537@phoenix.Princeton.EDU> Date: 3 Feb 90 08:09:39 GMT References: <31480@shemp.CS.UCLA.EDU> Reply-To: eliot@phoenix.Princeton.EDU (Eliot Handelman) Distribution: usa Organization: Princeton University, NJ Lines: 33 In article <31480@shemp.CS.UCLA.EDU> srt@maui.cs.ucla.edu (Scott Turner) writes: ; ; `(setf (structure-test foo) ; #'(lambda (*spec*) ,@test-part)) ; ;Let's say that I define this macro in the RULE package. Later on, I go to ;use this in the USER package, and looking at the macro-expansion I see ;this: ; ; (lambda (rule::*spec*) (eql *spec* 'hyper)) Well, if *spec* is special, as I maybe was your intention from using the stars, then you don't need the lambda list at all, so that's one solution. A second is to let the rule specify its parameters, something like this: (defmacro defrule (name params . test-part) `(setf (structure-test ',name) #'(lambda ,params ,@test-part))) Then you say: (rule::defrule big-rule (x) (:test (eql x 'foo)) (:action (cons x 'foo))) It might eventually be handy to generalize in this way, supposing you decide that the rules are interested in more than one parameter. Humbly offered, --Eliot Handelman Princeton U., Music