From: Sascha Ziemann <ceving@gmail.com>
To: kawa mailing list <kawa@sourceware.org>
Subject: syntax-rules problem
Date: Fri, 10 Mar 2017 09:35:00 -0000 [thread overview]
Message-ID: <CAGUt3y5kG3x462cDKCH4VueT8HLZmcKTvyTZ3thWL-9dFpCvSQ@mail.gmail.com> (raw)
I have the following macro.
(define-syntax define-facts
(syntax-rules ()
((_ (name a0 a1 ...) ((v00 v01 ...) (v10 v11 ...) ...))
'(define (name a0 a1 ...)
(conde
((== a0 v00) (== a1 v01) ...)
((== a0 v10) (== a1 v11) ...)
...)))))
Some Schemes like Guile, Chez, MIT and Ikarus succeed to evaluate the
following expression.
(define-facts (fathero f c)
(("Abraham" "Ismael")
("Abraham" "Isaac")
("Isaac" "Jacob")
("Jacob" "Benjamin")))
=>
(define (fathero f c)
(conde
((== f "Abraham") (== c "Ismael"))
((== f "Abraham") (== c "Isaac"))
((== f "Isaac") (== c "Jacob"))
((== f "Jacob") (== c "Benjamin"))))
But some fail. Kawa fails with an exception:
/dev/stdin:9:1: evaluating syntax transformer 'define-facts' threw
java.lang.ArrayIndexOutOfBoundsException: 1
I am still not sure, if it is a bug or if this is another undefined
part of Scheme.
Is it a bug?
next reply other threads:[~2017-03-10 9:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 9:35 Sascha Ziemann [this message]
2017-03-10 19:04 ` Per Bothner
2017-03-10 20:11 ` Per Bothner
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGUt3y5kG3x462cDKCH4VueT8HLZmcKTvyTZ3thWL-9dFpCvSQ@mail.gmail.com \
--to=ceving@gmail.com \
--cc=kawa@sourceware.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).