public inbox for
 help / color / mirror / Atom feed
From: Per Bothner <>
To: Philippe de Rochambeau <>,
Subject: Re: Recursive define-syntax
Date: Sun, 26 Sep 2021 14:04:23 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 9/26/21 05:08, Philippe de Rochambeau via Kawa wrote:
> 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

There is no standard Scheme 'match' syntax - there are a
number of different and incompatible extensions.  « A Pamphlet Against R »
uses the Guile language, which is quite different frm Kawa.

Specifically, the Kawa "pattern" syntax is quite limited - it
is mainly a proof of concept - a test of the basic framework.

Thar said, this seems to work:

(define (dim m)
  (match m
    ([first rest ...]
      `(,(length m) . ,(dim first)))

(dim m0) => (3 4)

> Are recursive « syntaxes »  not possible in Kawa?

Before you ask that question, you should try some code that
works on at least one other (preferable two) Scheme implementations.
If you have example code that works on other Scheme implementation(s)
and does not depend on an implementation-specific extension, but
not on Kawa - then we can discuss whether there is a Kawa bug or limitation.
	--Per Bothner

  reply	other threads:[~2021-09-26 21:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26 12:08 Philippe de Rochambeau
2021-09-26 21:04 ` Per Bothner [this message]
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:

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

  git send-email \ \ \ \ \

* 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).