From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp4-g21.free.fr (smtp4-g21.free.fr [212.27.42.4]) by sourceware.org (Postfix) with ESMTPS id 556C23858018 for ; Mon, 27 Sep 2021 05:31:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 556C23858018 Received: from smtpclient.apple (unknown [IPv6:2a01:e34:ec46:c6d0:10c9:7c78:83ac:fa7b]) (Authenticated sender: phiroc@free.fr) by smtp4-g21.free.fr (Postfix) with ESMTPSA id 111D519F59D; Mon, 27 Sep 2021 07:31:24 +0200 (CEST) From: Philippe de Rochambeau Mime-Version: 1.0 (1.0) Subject: Re: Recursive define-syntax Date: Mon, 27 Sep 2021 07:31:24 +0200 Message-Id: <762317F5-7B1D-4007-93CE-7FBDBAF16C2C@free.fr> References: <427B2D33-86D0-471D-9CDB-88F2877BE5F8@free.fr> In-Reply-To: <427B2D33-86D0-471D-9CDB-88F2877BE5F8@free.fr> To: Philippe de Rochambeau via Kawa X-Mailer: iPad Mail (19A346) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, MIME_QP_LONG_LINE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 05:31:30 -0000 BTW, Kawa is an amazing piece of software and it is my favorite JVM-based pr= ogramming language. Philippe > Le 27 sept. 2021 =C3=A0 07 a =C3=A9crit : >=20 > =EF=BB=BFHi 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=E2=80=99t work in Kawa, it doesn=E2= =80=99t really matter. >=20 > #| > Pamphlet, p. 52 > |# > (import (lispkit match)) > (import (srfi 48)) >=20 > (define (dim m) > (match m > ((first . rest) > `(,(length m) . ,(dim first))) > (_ > '()))) >=20 > Cheers, > Philippe >=20 >>> Le 26 sept. 2021 =C3=A0 23:04, Per Bothner a =C3=A9cri= t : >>>=20 >> =EF=BB=BF >>=20 >>> On 9/26/21 05:08, Philippe de Rochambeau via Kawa wrote: >>> Hello, >>> the following procedure, excerpted from =C2=AB A Pamphlet Against R =C2=BB= >>> (define (dim m) >>> (match m >>> ((first . rest) >>> `(,(length m) . ,(dim first))) >>> (_ >>> '()))) >>> =E2=80=A6 causes Kawa to display the following error message: >>> /dev/tty:6:5: unrecognized pattern operator first >>=20 >> There is no standard Scheme 'match' syntax - there are a >> number of different and incompatible extensions. =C2=AB A Pamphlet Again= st R =C2=BB >> uses the Guile language, which is quite different frm Kawa. >>=20 >> Specifically, the Kawa "pattern" syntax is quite limited - it >> is mainly a proof of concept - a test of the basic framework. >>=20 >> Thar said, this seems to work: >>=20 >> (define (dim m) >> (match m >> ([first rest ...] >> `(,(length m) . ,(dim first))) >> (_ >> '()))) >>=20 >> (dim m0) =3D> (3 4) >>=20 >>> Are recursive =C2=AB syntaxes =C2=BB not possible in Kawa? >>=20 >> 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 limitati= on. >> --=20 >> --Per Bothner >> per@bothner.com http://per.bothner.com/