guile-user
[Top][All Lists]
Advanced

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

Re: Problem with cond macro.


From: Joshua Judson Rosen
Subject: Re: Problem with cond macro.
Date: Tue, 16 Apr 2002 11:38:51 -0400
User-agent: Mutt/1.3.27i

On Tue, Apr 16, 2002 at 12:45:40PM +0300, Panagiotis Vossos wrote:
> guile> (use-modules (ice-9 syncase))
> guile> (version)
> "1.5.6"
> guile> (define-syntax foo
>        (syntax-rules (=>)
>          ((_ a => b) b)
>          ((_ a b c) (+ a b c))))
> 
> (foo 10 => 20)
> (let ((=> 10))
>   (foo 10 => 20))
> guile> 20
> guile> 20
> 
> What am I doing wrong ?

Try using:
        (use-syntax (ice-9 syncase))
... rather than:
        (use-modules (ice-9 syncase))

Doing so gets me proper results for not only your example from above, but
also for the canonical example from r5rs.

It looks like this is because (use-syntax ...) imports the specified
module and then does:

       (set-module-transformer! (current-module) (car (last-pair spec)))

... where spec is, in this case, (ice-9 syncase), so it sets syncase
(which is defined in the file, psyntax.ss, as sc-expand) as the syntax
transformer for the current module, and this procedure, sc-expand,
does some necessary transformations that aren't done by guile's
default (null?) transformer.

Someone else would have to explain why guile's default macro-expanding
behaviour is what it is.



reply via email to

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