Not sure what you really want to have expanded and what you want in the result. I have found it helpful to begin with the end in mind.
Assuming you want the initial form to look like...
(FOO SOMESTUFF)
Can you provide an example, i.e. replace SOMESTUFF with some actual stuff.
Then for this example, what do you want the final form to look like after expansion?
Now defining the macro is a simple matter of programming. Outside of the define-macro, you can play with quasiquotes to get just the data looking the way you want it.
-Patrick
-----Original Message----- From: gambit-list-bounces@iro.umontreal.ca [mailto:gambit-list-bounces@iro.umontreal.ca] On Behalf Of Eric Merritt Sent: Tuesday, March 29, 2005 5:06 PM To: Gambit List Subject: [gambit-list] Problem using 'if' in a macro to conditionaly definea let form
Guys,
I am having a bit of a problem with if in a macro and I could use some help. Say I have a macro similar to the following
(define-macro (foo somestuff) `(let ((x ,sumstuff) ,(if (is-cool sumstuff) `(do-something-else-cool))) (some-more-stuff)))
this will result in an ill formed let anytime 'some-stuff' isn't cool. Thats becuase the 'if' statement returns #!void in the expansion which is invalid. Cond does the same thing. Is there an alternate way to do this, am I missing something obvious? I get the feeling that I am.
Thanks, Eric _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca http://mailman.iro.umontreal.ca/mailman/listinfo/gambit-list