From: Panagiotis Vossos <jacbre@internet.gr>
Subject: Re: Problem with cond macro.
Date: Tue, 16 Apr 2002 12:45:40 +0300 [thread overview]
Message-ID: <m2662sase3.fsf@ground.control.net> (raw)
In-Reply-To: <lpit6shvu9.fsf@WarpCore.i.OpenIT.DE>
julian@openit.de (Julian v. Bock) writes:
> >>>>> "PV" == Panagiotis Vossos <jacbre@internet.gr> writes:
>
> PV> Ok, I just started studying macros, so I might be missing
> PV> something obvious, but the following example from r5rs doesn't
> PV> work correctly with guile:
>
> guile> (version)
> PV> "1.5.6"
> guile> (let ((=> #f))
> PV> (cond (#t => 'ok))) standard input:3:10: In expression (cond
> PV> (#t => #)): standard input:3:10: Wrong type to apply: ok ABORT:
> PV> (misc-error)
>
> This works only if cond is implemented as a R5RS macro. This is not
> guaranteed by the standard though.
Maybe, but I used a r5rs macro to implement 'my-cond' and it still
didn't work correctly. Here's a simpler case:
(define-syntax foo
(syntax-rules (=>)
((_ a => b) b)
((_ a b c) (+ a b c))))
(foo 10 => 20)
(let ((=> 10))
(foo 10 => 20))
As I understand it, the first use of the macro should return 20 and
the second 40 (SCM and s48 indeed return these values). But guile
fails on the second one and returns 20. Here's the exact session:
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 ?
panagiotis
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2002-04-16 9:45 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 [this message]
2002-04-16 11:10 ` Julian v. Bock
2002-04-16 15:38 ` Joshua Judson Rosen
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=m2662sase3.fsf@ground.control.net \
--to=jacbre@internet.gr \
/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).