chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Implementing a macroexpand-all


From: Patrick Li
Subject: Re: [Chicken-users] Implementing a macroexpand-all
Date: Fri, 11 Feb 2011 12:15:57 -0500

No I didn't.
Thank you. I will check that out!

On Fri, Feb 11, 2011 at 11:42 AM, Christian Kellermann <address@hidden> wrote:
* Patrick Li <address@hidden> [110211 17:20]:
> Hello everyone,
>
> I'm trying to write a simple macroexpand-all function (a function to
> recursively macroexpand all subforms in a form until there are absolutely no
> macros left in the form), and realized that my naive implementation has a
> serious bug in it, namely that it doesn't keep track of local bindings
> within an expanded form.
>
> Naive implementation:
> (define (macroexpand-all _expression_)
>   (let ((expanded (expand _expression_)))
>     (if (pair? expanded)
>         (map macroexpand-all expanded)
>         expanded)))
>
> I want the function to obey this property:
> (eval some-_expression_) is *always* equivalent to (eval (macroexpand-all
> some-_expression_))
>
> Is there an easy or existing way to do this? I have tried to write my own,
> but do not know which special forms actually introduce new bindings.

Are you aware of expand* from the expand-full egg?

Kind regards,

Christian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]