From: Philippe de Rochambeau <phiroc@free.fr>
To: kawa@sourceware.org
Subject: Recursive define-syntax
Date: Sun, 26 Sep 2021 14:08:12 +0200 [thread overview]
Message-ID: <52C4B57C-283E-4D90-A941-5A6FDA76EA73@free.fr> (raw)
Hello,
the following procedure, excerpted from « A Pamphlet Against R »
(define (dim m)
(match m
((first . rest)
`(,(length m) . ,(dim first)))
(_
'())))
… causes Kawa to display the following error message:
/dev/tty:6:5: unrecognized pattern operator first
I tried rewriting the dim procedure using define-syntax:
(define m0 '((1 2 3 4)(0 4 5 8)(0 0 7 6)))
(define-syntax dim
(lambda (m)
(syntax-case m ()
((_ frst . rst)
#`(#,(length m) . #,(dim first)))
(_
'()))))
…but to no avail:
matrix1.scm:7:17: duplicated pattern variable frst
matrix1.scm:7:13: duplicated pattern variable rst
matrix1.scm:7:17: duplicated pattern variable frst
matrix1.scm:7:13: duplicated pattern variable rst
…
Are recursive « syntaxes » not possible in Kawa?
Many thanks.
Philippe
next reply other threads:[~2021-09-26 12:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-26 12:08 Philippe de Rochambeau [this message]
2021-09-26 21:04 ` Per Bothner
2021-09-27 5:05 ` Philippe de Rochambeau
2021-09-27 5:31 ` Philippe de Rochambeau
2021-09-27 16:06 ` 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=52C4B57C-283E-4D90-A941-5A6FDA76EA73@free.fr \
--to=phiroc@free.fr \
--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).