unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Joshua Judson Rosen <rozzin@geekspace.com>
Cc: guile-user@gnu.org
Subject: Re: Problem with cond macro.
Date: Tue, 16 Apr 2002 11:38:51 -0400	[thread overview]
Message-ID: <20020416153851.GM4288@linger.twisted-muse.org> (raw)
In-Reply-To: <m2662sase3.fsf@ground.control.net>

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.

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


  parent reply	other threads:[~2002-04-16 15:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-15 22:41 Problem with cond macro Panagiotis Vossos
2002-04-16  8:49 ` Julian v. Bock
2002-04-16  9:45   ` Panagiotis Vossos
2002-04-16 11:10     ` Julian v. Bock
2002-04-16 15:38     ` Joshua Judson Rosen [this message]
2002-04-17  0:30       ` Panagiotis Vossos
2002-04-17 20:58         ` Neil Jerram
2002-04-20 12:21           ` Neil Jerram
2002-04-20 12:27             ` Neil Jerram
2002-04-17  5:34   ` Keith Wright
2002-04-25 21:59     ` Dirk Herrmann
2002-04-26  6:58       ` Keith Wright
2002-04-26 17:05       ` Marius Vollmer
2002-04-28 19:46         ` Dirk Herrmann
2002-05-07 18:41           ` Marius Vollmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020416153851.GM4288@linger.twisted-muse.org \
    --to=rozzin@geekspace.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).