From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel Subject: Re: new match system bug? Date: Sat, 4 Sep 2010 15:29:22 +0200 Message-ID: <201009041529.22455.stefan.tampe@spray.se> References: <201009041438.37352.stefan.tampe@spray.se> <878w3hy8xq.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1283606990 12656 80.91.229.12 (4 Sep 2010 13:29:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 4 Sep 2010 13:29:50 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Sep 04 15:29:49 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OrsoU-0002Le-KC for guile-devel@m.gmane.org; Sat, 04 Sep 2010 15:29:48 +0200 Original-Received: from localhost ([127.0.0.1]:60406 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrsoK-0000f8-LY for guile-devel@m.gmane.org; Sat, 04 Sep 2010 09:29:36 -0400 Original-Received: from [140.186.70.92] (port=32799 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrsoA-0000e6-Bh for guile-devel@gnu.org; Sat, 04 Sep 2010 09:29:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Orso9-0001TB-2F for guile-devel@gnu.org; Sat, 04 Sep 2010 09:29:26 -0400 Original-Received: from spsmtp02oc.mail2world.com ([74.202.142.198]:2421) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Orso8-0001Sx-UO for guile-devel@gnu.org; Sat, 04 Sep 2010 09:29:25 -0400 Original-Received: from mail pickup service by spsmtp02oc.mail2world.com with Microsoft SMTPSVC; Sat, 4 Sep 2010 06:29:23 -0700 auth-sender: stefan.tampe@spray.se Original-Received: from 82.182.254.46 unverified ([82.182.254.46]) by spsmtp02oc.mail2world.com with Mail2World SMTP Server; Sat, 04 Sep 2010 06:29:21 -0700 User-Agent: KMail/1.13.5 (Linux/2.6.34-12-desktop; KDE/4.4.4; x86_64; ; ) In-Reply-To: <878w3hy8xq.fsf@gnu.org> X-OriginalArrivalTime: 04 Sep 2010 13:29:23.0170 (UTC) FILETIME=[2FF42C20:01CB4C35] X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP4, XP SP1+ X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10854 Archived-At: On Saturday, September 04, 2010 02:44:49 pm Ludovic Court=C3=A8s wrote: > Hello! >=20 > Stefan Israelsson Tampe writes: > > While eating the dogfood of the new match macro I come across a bug > > e.g, this does not work! > >=20 > > (match '(a b) ((and x (a ... b)) a)) >=20 > But: >=20 > scheme@(guile-user)> (match '(a b) ((and x (a . b)) a)) > $1 =3D a >=20 > According to the grammar in the manual, I don=E2=80=99t think literal =E2= =80=98...=E2=80=99 can > be used in the middle of a list; it should only be used at the end of a > list, where it means =E2=80=9Czero or more=E2=80=9D: >=20 > scheme@(guile-user)> (match '(a b) ((a ...) a)) > $2 =3D (a b) >=20 > Thanks, > Ludo=E2=80=99. How true, It's just that the code we took has an extension with a Bug in it. It was intended to work for that case as well. =46rom match.upstream.scm: ;; 2007/07/21 - allowing ellipse patterns in non-final list positions They just stopped variants of the form (a ... b ...) cause it led to higher order matchers that could be avoided by another means me thinks.=20 So either. 1. we allow for this extension. or 2. Add a nice error message explaining that that feature is not suported. Right now - this is a Bug :-) Note. I would like to allow multiple a ... patterns but warn against it use= =20 and change the algorithm. The reason is that there exists a common pattern= =20 idiom. Namely ( a a a a - b b b b b - c c c c c) e.g. using separators.=20 essentially it is very kind to allow people to do: (match list ((x ... '- . l) (begin (handle x) (f l)))) So you essentially allow a anti gready ... operator. Note here that using <= x>=20 abstractions althogh it works for the above example, it cannot reproduce a = non gready operator. For that you would need the continuation inside the match abstractions. Cheers Stefan