guile-devel
[Top][All Lists]
Advanced

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

Re: macro expand in a specified module


From: Keisuke Nishida
Subject: Re: macro expand in a specified module
Date: Sat, 10 Mar 2001 04:01:46 -0500
User-agent: Wanderlust/2.4.0 (Rio) SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) Emacs/21.0.99 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Sat, 10 Mar 2001 03:35:31 -0500,
Keisuke Nishida wrote:
> 
>   (define (expand e m)
>     (cond
>      ((pair? e) (let* ((a (car e))
>                      (val (and (symbol? a) (module-ref m a))))
>                 (if (defmacro? val)
>                     (expand (apply (defmacro-transformer val) (cdr e)) m)
>                     e)))
>      (#t e)))

Bug fixed.

(define (expand x e)
  (if (pair? x)
      (let* ((s (car x))
             (v (and (symbol? s) (module-defined? e s) (module-ref e s))))
        (if (defmacro? v)
            (expand (apply (defmacro-transformer v) (cdr x)) e)
            (cons (expand (car x) e) (expand (cdr x) e))))
      x))

> May I add this to ice-9.scm?  I think this procedure looks good
> because it is symmetry to eval.

I mean boot-9.scm.

Kei



reply via email to

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