From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 20 23:35:04 2011 Received: (at submit) by debbugs.gnu.org; 21 Sep 2011 03:35:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R6DaR-0003mk-DI for submit@debbugs.gnu.org; Tue, 20 Sep 2011 23:35:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R6DaO-0003mL-MI for submit@debbugs.gnu.org; Tue, 20 Sep 2011 23:35:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6DaA-0003bI-VV for submit@debbugs.gnu.org; Tue, 20 Sep 2011 23:34:47 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:54673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6DaA-0003bC-Tx for submit@debbugs.gnu.org; Tue, 20 Sep 2011 23:34:46 -0400 Received: from eggs.gnu.org ([140.186.70.92]:52516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6Da9-0003Uv-Bq for bug-guile@gnu.org; Tue, 20 Sep 2011 23:34:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6Da8-0003aZ-0D for bug-guile@gnu.org; Tue, 20 Sep 2011 23:34:45 -0400 Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:54896 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6Da7-0003a2-RE for bug-guile@gnu.org; Tue, 20 Sep 2011 23:34:43 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 0F1457FC9 for ; Tue, 20 Sep 2011 23:34:42 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:mime-version:content-type; s=sasl; bh=u bpUpeOEXtumGTAh9Q7g2NXw11g=; b=dGSYdme+nufN7KCqV+N+wb/mdQNXT9Mip kv/wu7fxmHyLflBBcSzyrgA5P5mT3iRMLS2VaokJbG+oFNSJDJJrt/R4WfnMujKd HxXxAYX86ehHYXMKpoj3jXb0kHn6A0OTs7qpIHNOAHd9Q8GyGnNnIdVsgNo9/lV1 DK7g3s8WwE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :date:message-id:mime-version:content-type; q=dns; s=sasl; b=iuZ aMiQ7p6eAvuERm/VXa5kDAgRrkBBC/YMYNbkzUpYJnJkvcq21/o7l0FcsB71jOG2 D+qBBDbkQ0ipQekt5VtCwa4Xxrr5qt48K9gORmnThX29128dsDOIpzcMkane4WzB d2HgGPTa4yLsekHwRCqXl1GclHoDCmACpcE1PPVA= Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 084277FC8 for ; Tue, 20 Sep 2011 23:34:42 -0400 (EDT) Received: from badger (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id EF35A7FC7 for ; Tue, 20 Sep 2011 23:34:40 -0400 (EDT) From: Andy Wingo To: bug-guile Subject: curious match bug (?) Date: Wed, 21 Sep 2011 05:34:36 +0200 Message-ID: <87fwjqin5f.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Pobox-Relay-ID: A3DB2EC0-E402-11E0-A47E-65B1DE995924-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) Hi, Try this: (use-modules (language tree-il) (ice-9 match)) (define foo (parse-tree-il '(let-values (apply (lambda () (lambda-case ((() #f #f #f () ()) (apply (primitive values) (const 1) (const 2)))))) (lambda-case (((a b) #f #f #f () (#{a 134390}# #{b 134391}#)) (apply (primitive list) (lexical a #{a 134390}#) (lexical b #{b 134391}#))))))) (match foo (($ src exp ($ src2 req #f #f #f () gensyms body #f)) #t) (_ #f)) => #t (match foo (($ src foo ;; <- rename "exp" to "foo" ($ src2 req #f #f #f () gensyms body #f)) #t) (_ #f)) => #f I tried to reduce this case a bit, but didn't succeed directly, and I need to move on. But what is the deal here? Andy -- http://wingolog.org/ From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 21 12:10:26 2011 Received: (at 9567) by debbugs.gnu.org; 21 Sep 2011 16:10:26 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R6PNR-00053z-JQ for submit@debbugs.gnu.org; Wed, 21 Sep 2011 12:10:26 -0400 Received: from mail-iy0-f172.google.com ([209.85.210.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R6Lij-0008AV-Jd for 9567@debbugs.gnu.org; Wed, 21 Sep 2011 08:16:10 -0400 Received: by iaby26 with SMTP id y26so1662613iab.3 for <9567@debbugs.gnu.org>; Wed, 21 Sep 2011 05:15:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=rcERTBjuRmU7hlopxNyUzka4ytGlTUF7gjuRXL03a3A=; b=Gq6sRYtdgErKemgO/m4cqSFilqHm16Ki37ZddF4ubuzI3AObp2glaPqbGZq397BzfQ oERDCsdiBLx1pHpFNqdwDuAaL7qjxKpTaYFndrfHDaHdZhuYXXHrC7SAsMRk+R9D3Sxf gt9fCkiakI99mhWIfu9KnIHbUc4+Kw8IwblUI= MIME-Version: 1.0 Received: by 10.231.50.204 with SMTP id a12mr1492924ibg.11.1316607354297; Wed, 21 Sep 2011 05:15:54 -0700 (PDT) Received: by 10.231.50.71 with HTTP; Wed, 21 Sep 2011 05:15:53 -0700 (PDT) In-Reply-To: <87fwjqin5f.fsf@pobox.com> References: <87fwjqin5f.fsf@pobox.com> Date: Wed, 21 Sep 2011 14:15:53 +0200 Message-ID: Subject: Re: bug#9567: curious match bug (?) From: Stefan Israelsson Tampe To: 9567@debbugs.gnu.org, Andy Wingo Content-Type: multipart/mixed; boundary=00151774113aa95ded04ad72891e X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 9567 X-Mailman-Approved-At: Wed, 21 Sep 2011 12:10:24 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) --00151774113aa95ded04ad72891e Content-Type: multipart/alternative; boundary=00151774113aa95de504ad72891c --00151774113aa95de504ad72891c Content-Type: text/plain; charset=ISO-8859-1 This is an old bug I spotted before, it can be solved by inserting an extra let in the expansion aka (macroexpand '(match a (par code ...)) -> '(let ((arg a)) ....) This is missing from atoms in match so I added that there and the missbehavior dissapears. see the git diffed patch in this post. On Wed, Sep 21, 2011 at 5:34 AM, Andy Wingo wrote: > Hi, > > Try this: > > (use-modules (language tree-il) (ice-9 match)) > (define foo (parse-tree-il '(let-values (apply (lambda () (lambda-case > ((() #f #f #f () ()) (apply (primitive values) (const 1) (const 2)))))) > (lambda-case (((a b) #f #f #f () (#{a 134390}# #{b 134391}#)) (apply > (primitive list) (lexical a #{a 134390}#) (lexical b #{b 134391}#))))))) > (match foo > (($ src exp > ($ src2 req #f #f #f () gensyms body #f)) > #t) > (_ > #f)) > => #t > > (match foo > (($ src foo ;; <- rename "exp" to "foo" > ($ src2 req #f #f #f () gensyms body #f)) > #t) > (_ > #f)) > => #f > > I tried to reduce this case a bit, but didn't succeed directly, and I > need to move on. But what is the deal here? > > Andy > -- > http://wingolog.org/ > > > > --00151774113aa95de504ad72891c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable This is an old bug I spotted before, it can be solved by inserting an extra= let
in the expansion aka

(macroexpand '(match a (par code=A0= ...))
-> '(let ((arg a)) ....)

This is missing from atoms= in match so I added that there and the missbehavior dissapears. see the gi= t diffed patch in this post.


On Wed, Sep 21, 2011 at 5:34 AM, Andy Wi= ngo <wingo@pobox.co= m> wrote:
Hi,

Try this:

=A0(use-modules (language tree-il) (ice-9 match))
=A0(define foo (parse-tree-il '(let-values (apply (lambda () (lambda-c= ase ((() #f #f #f () ()) (apply (primitive values) (const 1) (const 2))))))= (lambda-case (((a b) #f #f #f () (#{a 134390}# #{b 134391}#)) (apply (prim= itive list) (lexical a #{a 134390}#) (lexical b #{b 134391}#)))))))
=A0(match foo
=A0 =A0(($ <let-values> src exp
=A0 =A0 =A0 =A0($ <lambda-case> src2 req #f #f #f () gensyms body #f= ))
=A0 =A0 #t)
=A0 =A0(_
=A0 =A0 #f))
=A0=3D> #t

=A0(match foo
=A0 =A0(($ <let-values> src foo ;; <- rename "exp" to &= quot;foo"
=A0 =A0 =A0 =A0($ <lambda-case> src2 req #f #f #f () gensyms body #f= ))
=A0 =A0 #t)
=A0 =A0(_
=A0 =A0 #f))
=A0=3D> #f

I tried to reduce this case a bit, but didn't succeed directly, and I need to move on. =A0But what is the deal here?

Andy
--
http://wingolog.org/=




--00151774113aa95de504ad72891c-- --00151774113aa95ded04ad72891e Content-Type: text/x-patch; charset=US-ASCII; name="match-bug.patch" Content-Disposition: attachment; filename="match-bug.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gsua4b040 ZGlmZiAtLWdpdCBhL21vZHVsZS9pY2UtOS9tYXRjaC5zY20gYi9tb2R1bGUvaWNlLTkvbWF0Y2gu c2NtCmluZGV4IDY4NjUzOWIuLjAzODRmNjkgMTAwNjQ0Ci0tLSBhL21vZHVsZS9pY2UtOS9tYXRj aC5zY20KKysrIGIvbW9kdWxlL2ljZS05L21hdGNoLnNjbQpAQCAtNTcsMyArNTcsMjEgQEAKIDs7 IE5vdGU6IE1ha2Ugc3VyZSB0byB1cGRhdGUgYG1hdGNoLnRlc3QudXBzdHJlYW0nIHdoZW4gdXBk YXRpbmcgdGhpcwogOzsgZmlsZS4KIChpbmNsdWRlLWZyb20tcGF0aCAiaWNlLTkvbWF0Y2gudXBz dHJlYW0uc2NtIikKKworKGRlZmluZS1zeW50YXggbWF0Y2gKKyAgKHN5bnRheC1ydWxlcyAoKQor ICAgICgobWF0Y2gpCisgICAgIChtYXRjaC1zeW50YXgtZXJyb3IgIm1pc3NpbmcgbWF0Y2ggZXhw cmVzc2lvbiIpKQorICAgICgobWF0Y2ggYXRvbSkKKyAgICAgKG1hdGNoLXN5bnRheC1lcnJvciAi bm8gbWF0Y2ggY2xhdXNlcyIpKQorICAgICgobWF0Y2ggKGFwcCAuLi4pIChwYXQgLiBib2R5KSAu Li4pCisgICAgIChsZXQgKCh2IChhcHAgLi4uKSkpCisgICAgICAgKG1hdGNoLW5leHQgdiAoKGFw cCAuLi4pIChzZXQhIChhcHAgLi4uKSkpIChwYXQgLiBib2R5KSAuLi4pKSkKKyAgICAoKG1hdGNo ICModmVjIC4uLikgKHBhdCAuIGJvZHkpIC4uLikKKyAgICAgKGxldCAoKHYgIyh2ZWMgLi4uKSkp CisgICAgICAgKG1hdGNoLW5leHQgdiAodiAoc2V0ISB2KSkgKHBhdCAuIGJvZHkpIC4uLikpKQor ICAgICgobWF0Y2ggYXRvbSAocGF0IC4gYm9keSkgLi4uKQorICAgICAobGV0ICgodiBhdG9tKSkK KyAgICAgICAobWF0Y2gtbmV4dCB2IChhdG9tIChzZXQhIGF0b20pKSAocGF0IC4gYm9keSkgLi4u KSkpCisgICAgKSkKKwo= --00151774113aa95ded04ad72891e-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 23 10:46:15 2011 Received: (at 9567) by debbugs.gnu.org; 23 Sep 2011 14:46:15 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R7715-0006uO-8i for submit@debbugs.gnu.org; Fri, 23 Sep 2011 10:46:15 -0400 Received: from solo.fdn.fr ([80.67.169.19]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R7712-0006uG-Lk for 9567@debbugs.gnu.org; Fri, 23 Sep 2011 10:46:13 -0400 Received: from pluto (unknown [193.50.110.208]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) (Authenticated sender: lcourtes) by smtp.fdn.fr (Postfix) with ESMTPSA id 2C831442D5; Fri, 23 Sep 2011 16:45:43 +0200 (CEST) From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) To: Andy Wingo Subject: Re: bug#9567: curious match bug (?) References: <87fwjqin5f.fsf@pobox.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 2 =?iso-8859-1?Q?Vend=E9miaire?= an 220 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Fri, 23 Sep 2011 16:45:43 +0200 In-Reply-To: <87fwjqin5f.fsf@pobox.com> (Andy Wingo's message of "Wed, 21 Sep 2011 05:34:36 +0200") Message-ID: <87d3ers4fc.fsf@gnu.org> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: 9567 Cc: 9567@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) Could it be a feature? (let ((pat '('a _ ...))) (match '(a b c) (pat #t))) => #t Ludo'. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 23 12:25:01 2011 Received: (at 9567) by debbugs.gnu.org; 23 Sep 2011 16:25:01 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R78Ye-0000gv-NE for submit@debbugs.gnu.org; Fri, 23 Sep 2011 12:25:00 -0400 Received: from mail-iy0-f172.google.com ([209.85.210.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R78Yc-0000gn-3n for 9567@debbugs.gnu.org; Fri, 23 Sep 2011 12:24:59 -0400 Received: by iaby26 with SMTP id y26so4000540iab.3 for <9567@debbugs.gnu.org>; Fri, 23 Sep 2011 09:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=lzbO5Y7QCCEjQsXdk1wCHwr7DPMWP14y8MelOgCXcIY=; b=QrQoMEujYggV5yusrX7muAt+KuZlI7MjFzCJWYC1kP6vZ1/UCT782WEsj/cyiFJBhM 8GFDblZM5gqSxI5CY8rqOVWwTPwMHg5AKEP/TJDcTWT1NtTSpYEotpsMgWxkKV+zZ59V Aiyy1gotteCy18+6h7n8YMb1HCO1oTQs8BLHM= MIME-Version: 1.0 Received: by 10.231.50.204 with SMTP id a12mr5963005ibg.11.1316795070463; Fri, 23 Sep 2011 09:24:30 -0700 (PDT) Received: by 10.231.50.71 with HTTP; Fri, 23 Sep 2011 09:24:30 -0700 (PDT) In-Reply-To: <87d3ers4fc.fsf@gnu.org> References: <87fwjqin5f.fsf@pobox.com> <87d3ers4fc.fsf@gnu.org> Date: Fri, 23 Sep 2011 18:24:30 +0200 Message-ID: Subject: Re: bug#9567: curious match bug (?) From: Stefan Israelsson Tampe To: =?ISO-8859-1?Q?Ludovic_Court=E8s?= , 9567@debbugs.gnu.org, wingo@pobox.com Content-Type: multipart/alternative; boundary=00151774113a6ac05604ad9e3ea3 X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 9567 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) --00151774113a6ac05604ad9e3ea3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On the other hand (let ((pat '(a _ ...))) (match '(x y z) (pat #t))) $1 =3D #t as well, a more canonical example of this problem (where I saw it first) are when using 'and' e.g. (define a '(1 2)) (match a ((and (a 2) (1 b)) (+ a b)) (_ #f)) -> #f But with my fix you wil get the correct 3. Now the reson are that for 'and' as well as for '$' another location a is under the command of an implicit (let ((a car)) ...). One could perhaps argue that this is a bug in syntax handling but I would not think so. Anyway maybe we should consider moving this fix upstream. /Stefan 2011/9/23 Ludovic Court=E8s > Could it be a feature? > > (let ((pat '('a _ ...))) > (match '(a b c) (pat #t))) > =3D> #t > > Ludo'. > > > > --00151774113a6ac05604ad9e3ea3 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On the other hand

(let ((pat '(a _ ...)))
=A0=A0 (match = '(x y z) (pat #t)))
$1 =3D #t

as well,

a more canonica= l example of this problem (where I saw it first)
are when using 'an= d' e.g.

(define a '(1 2))

(match a ((and (a 2) (1 b)) (+ a b)) (_ #f= ))
-> #f

But with my fix you wil get the correct 3.

Now= the reson are that for 'and' as well as for '$' another lo= cation a is under the command
of an implicit (let ((a car)) ...). One could perhaps argue that this is a = bug in syntax handling but I would not think so. Anyway maybe we should con= sider moving this fix upstream.

/Stefan
2011/9/23 Ludovic Court=E8s <ludo@gnu.org>
Could it be a feature?

=A0(let ((pat '('a _ ...)))
=A0 =A0(match '(a b c) (pat #t)))
=A0=3D> #t

Ludo'.




--00151774113a6ac05604ad9e3ea3-- From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 24 10:51:42 2011 Received: (at 9567) by debbugs.gnu.org; 24 Sep 2011 14:51:42 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R7TZu-0001aL-52 for submit@debbugs.gnu.org; Sat, 24 Sep 2011 10:51:42 -0400 Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62] helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R7TZp-0001aB-PR for 9567@debbugs.gnu.org; Sat, 24 Sep 2011 10:51:39 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id B3C4E7D0A; Sat, 24 Sep 2011 10:51:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=X636CkVG5TT8 QG+aL7jAFrhzgmk=; b=MA5BznliPnwjln6uaRm8uKIN62A7u14viZOacKF6jxDH +EGIEF/fWMp50Ha6B4r47tTbfyRBg7xcRigYWd2+UW0aZFECMFh8XcLBavWUjE3G eN4ApSpfzBSgIp17OhdrVh4IEh8nYa/x1FukpfN+chjSMZgOKU6P7UZudoHo2QM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=E8kp9q 65eqWjGp71aqKRvvXA7in5/+xrjaB+rY5nq6mTO8V5OkV9ut3Bk9d+QQVdZpifh9 MLUUG8T12oDlWDkGc0c81cF1ABgJDBvReE4jnmVMw7ZN36VWV3Vi5SbPxClKW7k/ DwwccJPemraoURdRytCDhvE1C8ROrA1ksfmzY= Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id AB7CF7D09; Sat, 24 Sep 2011 10:51:04 -0400 (EDT) Received: from badger (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 2F3FF7D08; Sat, 24 Sep 2011 10:51:04 -0400 (EDT) From: Andy Wingo To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: bug#9567: curious match bug (?) References: <87fwjqin5f.fsf@pobox.com> <87d3ers4fc.fsf@gnu.org> Date: Sat, 24 Sep 2011 16:51:00 +0200 In-Reply-To: <87d3ers4fc.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Fri, 23 Sep 2011 16:45:43 +0200") Message-ID: <877h4yf0yz.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Pobox-Relay-ID: A093C6C0-E6BC-11E0-AB24-65B1DE995924-02397024!a-pb-sasl-sd.pobox.com X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 9567 Cc: 9567@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.2 (---) On Fri 23 Sep 2011 16:45, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Could it be a feature? > > (let ((pat '('a _ ...))) > (match '(a b c) (pat #t))) > =3D> #t `match' compiles patterns to Scheme code at macro expansion time. It doesn't do runtime matching. Are you thinking that `pat' is being used as a pattern? It is not: (let ((pat '('b _ ...))) (match '(a b c) (pat #t))) =3D> #t =20=20 If it were a pattern, it would not match. It is a bug IMO. Andy --=20 http://wingolog.org/ From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 24 11:02:17 2011 Received: (at 9567) by debbugs.gnu.org; 24 Sep 2011 15:02:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R7Tk8-0001pQ-KX for submit@debbugs.gnu.org; Sat, 24 Sep 2011 11:02:17 -0400 Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62] helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R7Tk6-0001pK-O9 for 9567@debbugs.gnu.org; Sat, 24 Sep 2011 11:02:15 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 0044F7DFA; Sat, 24 Sep 2011 11:01:42 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:mime-version:content-type; s=sasl; bh=Z bXsqL3SxadrtFSNearVgpuqI/c=; b=XaOgtHN4mtU1wrjaBEnN7jsE/UdWsL6iN ss5HF5PEp3U6fCnsJmo2qHF76cOKtvr1TdvDhvOJnZ80oqPg5ehNFsEeqwRrEM/+ 9LZQ5li8836jt71kRwFdHvqE1+vqL/z0StK2AawBR6bcN6c8lmjtNmvakWxPFNse Yenerd9OAo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:date:message-id:mime-version:content-type; q=dns; s= sasl; b=t0nJQIw7yF+hZlXlnwWSZMThrselucPtB6GTqo1h2bp+FM4MTynV7ad7 lWvW9vSAryQQGwW467dYxmCFwDPyKBA7amRMKyqhwD4xj2GDh74JSttzgrOVAIkb 9Hj7SJ0yDPE6d7HnFhJolrd6o8bT0JXSpf4NjjtPAXKmOcjAgSc= Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id D1A277DF9; Sat, 24 Sep 2011 11:01:41 -0400 (EDT) Received: from badger (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id CF5097DF8; Sat, 24 Sep 2011 11:01:40 -0400 (EDT) From: Andy Wingo To: Alex Shinn Subject: `match' bug ? Date: Sat, 24 Sep 2011 17:01:37 +0200 Message-ID: <8739fmf0ha.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Pobox-Relay-ID: 1C0D776E-E6BE-11E0-97A0-65B1DE995924-02397024!a-pb-sasl-sd.pobox.com X-Spam-Score: -3.2 (---) X-Debbugs-Envelope-To: 9567 Cc: 9567@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) Hi Alex, We are getting the following bug in Guile: > (use-modules (ice-9 match)) This imports your `match' library. > (define a '(1)) > (match a (((and a 1)) a) (_ #f)) 1 Here we destructured the first element from '(1). > (define a '(1 2)) > (match a ((and (a 2) (1 b)) (+ a b)) (_ #f)) #f Now we are trying to destructure the first two elements from '(1 2). But it doesn't work! OTOH it does work if we rename the pattern vars: > (match a ((and (x 2) (1 y)) (+ x y)) (_ #f)) 3 Can you reproduce this bug on other Schemes? Could it be that the code to extract vars to be bound is erroneously propagating the var bound to the input value? Or is it a bug in Guile? Stefan Israelsson Tampe reports that the following redefinition of `match' fixes the problem for him: (define-syntax match (syntax-rules () ((match) (match-syntax-error "missing match expression")) ((match atom) (match-syntax-error "no match clauses")) ((match (app ...) (pat . body) ...) (let ((v (app ...))) (match-next v ((app ...) (set! (app ...))) (pat . body) ...))) ((match #(vec ...) (pat . body) ...) (let ((v #(vec ...))) (match-next v (v (set! v)) (pat . body) ...))) ((match atom (pat . body) ...) (let ((v atom)) (match-next v (atom (set! atom)) (pat . body) ...))))) As you see the last case introduces a `let'. Regards, Andy -- http://wingolog.org/ From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 25 03:00:07 2011 Received: (at 9567) by debbugs.gnu.org; 25 Sep 2011 07:00:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R7ih1-00087K-6d for submit@debbugs.gnu.org; Sun, 25 Sep 2011 03:00:06 -0400 Received: from mail-ey0-f172.google.com ([209.85.215.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R7igt-00086O-SB for 9567@debbugs.gnu.org; Sun, 25 Sep 2011 02:59:57 -0400 Received: by eye4 with SMTP id 4so3508848eye.3 for <9567@debbugs.gnu.org>; Sat, 24 Sep 2011 23:59:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=NEsv/3ZcsIFMslFn4HKBTd2WLYc/aGnIjJEr5f4PCdU=; b=omKpRh65gRT9kndkXVmkgOmU67psr8PVhVNymJ8rDdAJaJQbctLmtpcHsQ7cMW6K9D /vytEXRwVx5aenq6UR4BL55ECB0hLOxFiSmUmfnAcFZVzdOiYlExV+xEYL2gRmlivo+r 7jyCNlZ845LHWMu070RyVEcyZCWESSSc2t5T8= MIME-Version: 1.0 Received: by 10.213.26.213 with SMTP id f21mr87393ebc.115.1316933957738; Sat, 24 Sep 2011 23:59:17 -0700 (PDT) Received: by 10.213.98.67 with HTTP; Sat, 24 Sep 2011 23:59:17 -0700 (PDT) In-Reply-To: <8739fmf0ha.fsf@pobox.com> References: <8739fmf0ha.fsf@pobox.com> Date: Sun, 25 Sep 2011 15:59:17 +0900 Message-ID: Subject: Re: `match' bug ? From: Alex Shinn To: Andy Wingo Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 9567 Cc: 9567@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) Hi Andy, On Sun, Sep 25, 2011 at 12:01 AM, Andy Wingo wrote: > > We are getting the following bug in Guile: > [...] > > =A0 =A0> (define a '(1 2)) > =A0 =A0> (match a ((and (a 2) (1 b)) (+ a b)) (_ #f)) > =A0 =A0#f Yes, that's a bug - confirmed in Chibi. The diagnosis is also correct. I've applied the patch and updated the synthcode match.scm and the Chibi repo. Thanks Stefan! --=20 Alex From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 15 10:08:14 2011 Received: (at 9567) by debbugs.gnu.org; 15 Oct 2011 14:08:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RF4uM-000548-4N for submit@debbugs.gnu.org; Sat, 15 Oct 2011 10:08:14 -0400 Received: from mail1-relais-roc.national.inria.fr ([192.134.164.82]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RF4uJ-00053s-4D for 9567@debbugs.gnu.org; Sat, 15 Oct 2011 10:08:12 -0400 X-IronPort-AV: E=Sophos;i="4.69,350,1315173600"; d="scan'208";a="124254374" Received: from reverse-83.fdn.fr (HELO pluto) ([80.67.176.83]) by mail1-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 15 Oct 2011 16:07:23 +0200 From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) To: Alex Shinn Subject: Re: bug#9567: `match' bug ? References: <8739fmf0ha.fsf@pobox.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 24 =?iso-8859-1?Q?Vend=E9miaire?= an 220 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Sat, 15 Oct 2011 16:07:20 +0200 In-Reply-To: (Alex Shinn's message of "Sun, 25 Sep 2011 15:59:17 +0900") Message-ID: <87botinyav.fsf@gnu.org> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -8.0 (--------) X-Debbugs-Envelope-To: 9567 Cc: Andy Wingo , 9567@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -8.1 (--------) Hi Alex, Alex Shinn skribis: > On Sun, Sep 25, 2011 at 12:01 AM, Andy Wingo wrote: >> >> We are getting the following bug in Guile: >> [...] >> >> =C2=A0 =C2=A0> (define a '(1 2)) >> =C2=A0 =C2=A0> (match a ((and (a 2) (1 b)) (+ a b)) (_ #f)) >> =C2=A0 =C2=A0#f > > Yes, that's a bug - confirmed in Chibi. The > diagnosis is also correct. I've applied the > patch and updated the synthcode match.scm > and the Chibi repo. I=E2=80=99m trying to update Guile=E2=80=99s copy from Chibi but changeset 876:528cdab3f818 in the default branch doesn=E2=80=99t seem to contain the = fix. What am I missing? Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 16 03:29:22 2011 Received: (at 9567) by debbugs.gnu.org; 16 Oct 2011 07:29:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RFL9u-00048B-BT for submit@debbugs.gnu.org; Sun, 16 Oct 2011 03:29:22 -0400 Received: from mail-ey0-f172.google.com ([209.85.215.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RFL9s-00047y-OR for 9567@debbugs.gnu.org; Sun, 16 Oct 2011 03:29:21 -0400 Received: by eyg24 with SMTP id 24so2409789eyg.3 for <9567@debbugs.gnu.org>; Sun, 16 Oct 2011 00:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=wJzF3Qo2IY01de8jw/kBqXMHybscq5OzxfGR5VVhVIg=; b=sQ6lJqC5nn6zAnHa8OztU+RwzZ8+u+qiSyyK5e660F8nqOKoDJAeLLNfj5gRElTG3M m2GHZ6BdxZUbOBXKz2zCrzCtedGSPzyJJd7ZgpNWQxrD11QXxFNdDhxK4JUveXKOByfW 5nQrdaEfq/K3ln5eq1TWHbiftlfeCjmyby38s= MIME-Version: 1.0 Received: by 10.213.20.5 with SMTP id d5mr1917734ebb.116.1318750110833; Sun, 16 Oct 2011 00:28:30 -0700 (PDT) Received: by 10.213.25.147 with HTTP; Sun, 16 Oct 2011 00:28:30 -0700 (PDT) In-Reply-To: <87botinyav.fsf@gnu.org> References: <8739fmf0ha.fsf@pobox.com> <87botinyav.fsf@gnu.org> Date: Sun, 16 Oct 2011 16:28:30 +0900 Message-ID: Subject: Re: bug#9567: `match' bug ? From: Alex Shinn To: =?ISO-8859-1?Q?Ludovic_Court=E8s?= Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: 9567 Cc: Andy Wingo , 9567@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) Hi Ludovic, 2011/10/15 Ludovic Court=E8s : > > I=92m trying to update Guile=92s copy from Chibi but changeset > 876:528cdab3f818 in the default branch doesn=92t seem to contain the fix. > > What am I missing? "hg export 851" will show you the changes, including the new test case. Does it not work in Guile? On the off chance you're unfamiliar with mercurial, did you remember to "hg update" after fetching the changes? --=20 Alex From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 16 12:39:53 2011 Received: (at 9567-done) by debbugs.gnu.org; 16 Oct 2011 16:39:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RFTkf-0000c2-2f for submit@debbugs.gnu.org; Sun, 16 Oct 2011 12:39:53 -0400 Received: from mail4-relais-sop.national.inria.fr ([192.134.164.105]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RFTkc-0000bm-DE for 9567-done@debbugs.gnu.org; Sun, 16 Oct 2011 12:39:51 -0400 X-IronPort-AV: E=Sophos;i="4.69,354,1315173600"; d="scan'208";a="113095012" Received: from reverse-83.fdn.fr (HELO pluto) ([80.67.176.83]) by mail4-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 16 Oct 2011 18:38:56 +0200 From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) To: Alex Shinn Subject: Re: bug#9567: `match' bug ? References: <8739fmf0ha.fsf@pobox.com> <87botinyav.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 =?iso-8859-1?Q?Vend=E9miaire?= an 220 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Sun, 16 Oct 2011 18:38:52 +0200 In-Reply-To: (Alex Shinn's message of "Sun, 16 Oct 2011 16:28:30 +0900") Message-ID: <87wrc4lwmb.fsf@gnu.org> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -8.2 (--------) X-Debbugs-Envelope-To: 9567-done Cc: Andy Wingo , 9567-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -8.3 (--------) Hi Alex, Alex Shinn skribis: > 2011/10/15 Ludovic Court=C3=A8s : >> >> I=E2=80=99m trying to update Guile=E2=80=99s copy from Chibi but changes= et >> 876:528cdab3f818 in the default branch doesn=E2=80=99t seem to contain t= he fix. >> >> What am I missing? > > "hg export 851" will show you the changes, including > the new test case. Does it not work in Guile? Yes. > On the off chance you're unfamiliar with mercurial, > did you remember to "hg update" after fetching the > changes? Oh indeed, I had run =E2=80=98hg pull=E2=80=99 (I think) but not =E2=80=98h= g update=E2=80=99. Thanks! Ludo=E2=80=99. From unknown Sat Jun 21 10:40:02 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 14 Nov 2011 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator