From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxime Devos Newsgroups: gmane.lisp.guile.bugs Subject: bug#48318: (ice-9 match) does not allow distinguishing between () and #nil Date: Sun, 09 May 2021 18:42:40 +0200 Message-ID: <4c8839f49a6c7317324d5360d74594c181b0588b.camel@telenet.be> Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-W7rR4/1OKaSnlkD/yGzq" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32350"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.34.2 To: 48318@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sun May 09 18:44:08 2021 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lfmXI-0008Jm-BW for guile-bugs@m.gmane-mx.org; Sun, 09 May 2021 18:44:08 +0200 Original-Received: from localhost ([::1]:45910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfmXH-0000iF-Cn for guile-bugs@m.gmane-mx.org; Sun, 09 May 2021 12:44:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfmXC-0000fh-Jj for bug-guile@gnu.org; Sun, 09 May 2021 12:44:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfmXC-0000aZ-CU for bug-guile@gnu.org; Sun, 09 May 2021 12:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lfmXC-0001SG-Ax for bug-guile@gnu.org; Sun, 09 May 2021 12:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 09 May 2021 16:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48318 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16205785835561 (code B ref -1); Sun, 09 May 2021 16:44:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 May 2021 16:43:03 +0000 Original-Received: from localhost ([127.0.0.1]:56202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfmWF-0001Rd-Eg for submit@debbugs.gnu.org; Sun, 09 May 2021 12:43:03 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:46270) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfmWD-0001RD-U7 for submit@debbugs.gnu.org; Sun, 09 May 2021 12:43:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfmWD-0008Gz-EU for bug-guile@gnu.org; Sun, 09 May 2021 12:43:01 -0400 Original-Received: from baptiste.telenet-ops.be ([2a02:1800:120:4::f00:13]:57922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfmW7-0008Pt-J7 for bug-guile@gnu.org; Sun, 09 May 2021 12:43:01 -0400 Original-Received: from butterfly.local ([213.251.116.230]) by baptiste.telenet-ops.be with bizsmtp id 2giq2500C4yL7Jl01girJw; Sun, 09 May 2021 18:42:51 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1620578571; bh=7wkOmWiEKsCwhuuaqm/p8KeOavnK7CDbREpqWJa2+Fg=; h=Subject:From:To:Date; b=aKnPqmtsi6b3142x8U/0faw2a7DVnuutM9wYiE/QrD/guKP4/6PV1WjqoSXBYaqkX ExusR48lTJGFJ+9k8V40/hLXHgJ4WwTELagAEMDXlokgWBYoB6KWGdtCL4Ju3hLp8Z Phnq2nsGPfmcV2B3JRknVQJN6ZuV5CLJjLSqEsPmma9S6DB5nGrjAHhwIFWpNen8bk vbPk5HZ7zCubIMcjM4wgWKhSe95xj7K6S8ihvAoa3YKDGkVaBLCt4yhsHI2AGbO7gA 3fJFPTM8zc3N0K7gudHUIbjiBceH0GWL/Unuvsq5JnR2J4QWL6NcYuSKpM9sGQZSAm AnRcwqj9kh6Jw== Received-SPF: pass client-ip=2a02:1800:120:4::f00:13; envelope-from=maximedevos@telenet.be; helo=baptiste.telenet-ops.be X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10040 Archived-At: --=-W7rR4/1OKaSnlkD/yGzq Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi guilers, I've found the following surprising behaviour: (use-modules (ice-9 match)) (match (identity #nil) (() 'scheme-eol) (#nil 'elisp-eol)) --> scheme-eol, expected elisp-eol (match '() (#nil 'elisp-eol) (() 'elisp-eol)) --> elisp-eol, expected scheme-eol Treating () and #nil as equivalent makes sense, but should be documented. My suspicion, currently untested: the following code in ice-9/match.upstream.scm ... (define-syntax match-two (syntax-rules (_ ___ ..1 *** quote quasiquote ? $ =3D and or not set! get= !) ((match-two v () g+s (sk ...) fk i) (if (null? v) (sk ... i) fk)) [..] should be: (define-syntax match-two (syntax-rules (_ ___ ..1 *** quote quasiquote ? $ =3D and or not set! get= !) ((match-two v () g+s (sk ...) fk i) (if (eq? v '()) (sk ... i) fk)) ((match-two v #nil g+s (sk ...) fk i) (if (eq? v #nil) (sk ... i) fk)) [...] And the following might need similar adjustment: ((match-two v (p) g+s sk fk i) (if (and (pair? v) (null? (cdr v))) (let ((w (car v))) (match-one w p ((car v) (set-car! v)) sk fk i)) fk)) Greetings, Maxime. --=-W7rR4/1OKaSnlkD/yGzq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYJgRABccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7sMsAP46Jl7Xfo8PL/lkADk9yc7MvtVr whcPMIpVkvgLIauCKQEA113noQSu2c4N38v3QjG3BmN8+KX1qsAZwBEpOyyN2gE= =8eS9 -----END PGP SIGNATURE----- --=-W7rR4/1OKaSnlkD/yGzq--