public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Philippe de Rochambeau <phiroc@free.fr>
To: Philippe de Rochambeau via Kawa <kawa@sourceware.org>
Subject: Re: Recursive define-syntax
Date: Mon, 27 Sep 2021 07:31:24 +0200	[thread overview]
Message-ID: <762317F5-7B1D-4007-93CE-7FBDBAF16C2C@free.fr> (raw)
In-Reply-To: <427B2D33-86D0-471D-9CDB-88F2877BE5F8@free.fr>

BTW, Kawa is an amazing piece of software and it is my favorite JVM-based programming language.

Philippe

> Le 27 sept. 2021 à 07 a écrit :
> 
> Hi Per,
> Thank you for your feedback.
> The code works on LispKit (cf. https://github.com/objecthub/swift-lispkit) which is based on R7RS. But if it doesn’t work in Kawa, it doesn’t really matter.
> 
> #|
> Pamphlet, p. 52
> |#
> (import (lispkit match))
> (import (srfi 48))
> 
> (define (dim m)
>  (match m
>    ((first . rest)
>      `(,(length m) . ,(dim first)))
>     (_
>       '())))
> 
> Cheers,
> Philippe
> 
>>> Le 26 sept. 2021 à 23:04, Per Bothner <per@bothner.com> a écrit :
>>> 
>> 
>> 
>>> 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-27  5:31 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
2021-09-27  5:05   ` Philippe de Rochambeau
2021-09-27  5:31     ` Philippe de Rochambeau [this message]
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=762317F5-7B1D-4007-93CE-7FBDBAF16C2C@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).