From: Steve Long
Subject: Re: help with nested macros
Date: 
Message-ID: <3BEAC1AA.83E0B9D1@isomedia.com>
Swap the compilation order of the two macros and see what happens.

Myriam Abramson wrote:

> 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?
>
> TIA
> --
>                                    myriam