From: Lieven Marchand
Subject: Re: help with nested macros
Date: 
Message-ID: <m3wv13svee.fsf@localhost.localdomain>
Myriam Abramson <········@osf1.gmu.edu> writes:

> Hi!
> 
> I'm back into lisp after being away for more than 2 years, yeah!
> 
> Anyway, enough excuses, I want to write a macro such as 
> 
> (defmacro defcom (fn args &rest rules)
>   `(defun ,fn (&key ,@args &allow-other-keys)
>        (with-appropriate-vars (var ',fn)
>           ,@rules)))
> 
> (defmacro with-appropriate-vars ((var fn) &body body)
>    `(let ((,var '(0 0 0 0)))
>        (when (appropriate-p ,fn)
>            (setf ,var (set-var)))
>         ,@body))
> 
> 
> When expanded, the function created does not have
> with-appropriate-vars expanded to the let clause so I'm obviously
> doing something wrong. What's the best way to write defcom? 

There's nothing wrong with it. Probably the way you expand in your
environment stops after 1 level. If you compile or evaluate a defcom
form, everything will be expanded.

-- 
Lieven Marchand <···@wyrd.be>
She says, "Honey, you're a Bastard of great proportion."
He says, "Darling, I plead guilty to that sin."
Cowboy Junkies -- A few simple words