chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Is there any way programmatically to determine a mac


From: felix winkelmann
Subject: Re: [Chicken-users] Is there any way programmatically to determine a macro?
Date: Tue, 6 Jan 2009 10:39:00 +0100

On Mon, Jan 5, 2009 at 11:48 PM, Lam Luu <address@hidden> wrote:
> Hello all!
> Given an S-Expression, (here is an example), is there any way to write a
> script to determine whether or not that expression is a procedure-call or a
> macro? If it is a macro call, is there anyway to expand it back to the
> lowest level of special form possible?
> Currently, the only way I know if is using expand-syntax procedure, but that
> seems to be for interactive use only.

You can use `(macro? <symbol>)' to check whether a symbol is a macro,
and run `macroexpand' (or `expand' in chicken 4) repeatedly for s-expressions
that have a macro name as first element. Full expansion of arbitrary expressions
will need a code-walker, though.


cheers,
felix




reply via email to

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