public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Philippe de Rochambeau <phiroc@free.fr>, kawa@sourceware.org
Subject: Re: Recursive define-syntax
Date: Sun, 26 Sep 2021 14:04:23 -0700	[thread overview]
Message-ID: <c59bb3ae-9f7a-7929-1d2a-39fc38f7b474@bothner.com> (raw)
In-Reply-To: <52C4B57C-283E-4D90-A941-5A6FDA76EA73@free.fr>



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
per@bothner.com   http://per.bothner.com/

  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:
  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=c59bb3ae-9f7a-7929-1d2a-39fc38f7b474@bothner.com \
    --to=per@bothner.com \
    --cc=kawa@sourceware.org \
    --cc=phiroc@free.fr \
    /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).