From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: =?utf-8?b?4oCYbWF0Y2jigJk=?= and =?utf-8?b?4oCcaw==?= or =?utf-8?b?bW9yZeKAnQ==?= patterns Date: Wed, 08 Sep 2010 14:06:00 +0200 Message-ID: <87sk1ko2xj.fsf@gnu.org> References: <877hj0xmcp.fsf@gnu.org> <874oe36pgn.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 1283947581 8183 80.91.229.12 (8 Sep 2010 12:06:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Sep 2010 12:06:21 +0000 (UTC) Cc: guile-devel@gnu.org To: Alex Shinn Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Sep 08 14:06:17 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 1OtJPr-00013Z-Bh for guile-devel@m.gmane.org; Wed, 08 Sep 2010 14:06:16 +0200 Original-Received: from localhost ([127.0.0.1]:40971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtJPp-0005cI-Ib for guile-devel@m.gmane.org; Wed, 08 Sep 2010 08:06:13 -0400 Original-Received: from [140.186.70.92] (port=47827 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtJPi-0005cA-HK for guile-devel@gnu.org; Wed, 08 Sep 2010 08:06:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OtJPe-0007F7-BR for guile-devel@gnu.org; Wed, 08 Sep 2010 08:06:06 -0400 Original-Received: from mail1-relais-roc.national.inria.fr ([192.134.164.82]:36190) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OtJPe-0007Eh-5M for guile-devel@gnu.org; Wed, 08 Sep 2010 08:06:02 -0400 X-IronPort-AV: E=Sophos;i="4.56,334,1280700000"; d="scan'208";a="67121658" Original-Received: from laptop-147-210-128-193.labri.fr (HELO nixey) ([147.210.128.193]) by mail1-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 08 Sep 2010 14:06:00 +0200 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 22 Fructidor an 218 de la =?iso-8859-1?Q?R=E9volutio?= =?iso-8859-1?Q?n?= 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 In-Reply-To: (Alex Shinn's message of "Wed, 8 Sep 2010 11:18:18 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:10892 Archived-At: Hi, Alex Shinn writes: > On Mon, Sep 6, 2010 at 9:12 PM, Ludovic Court=C3=A8s wrote: >> >> Well, since there are only 9 of them, they could probably be implemented >> as special cases, with an augmented =E2=80=98match-gen-ellipses=E2=80=99= , which would be >> told the minimum number of elements expected? > > Oh, the Wright syntax limited you to 9 forms, so "..10" is illegal? >From Wright=E2=80=99s 1995 paper & doc I thought k > 9 wasn=E2=80=99t suppo= rted but apparently it is: --8<---------------cut here---------------start------------->8--- guile> (use-modules (ice-9 match)) ;; <- Wright=E2=80=99s code guile> (match (iota 30) ((a ..10) a)) $1 =3D (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25= 26 27 28 29) guile> (match (iota 30) ((a ..22) a)) $2 =3D (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25= 26 27 28 29) guile> (version) $3 =3D "1.8.7" --8<---------------cut here---------------end--------------->8--- :-( > "..1" is actually useful - it's the analog of "+" in regular > expressions, and allows simplifying many syntax-rules > patterns you see written (elt0 elt1 ...) as (elt ..1). If > the elements are more complex patterns this is a big > win. Agreed. So perhaps one solution would be to: 1. Have a special case for =E2=80=98..1=E2=80=99, since it=E2=80=99s quit= e handy. 2. Have a new syntax form, like =E2=80=98.. k=E2=80=99, as you suggested. What do you think? Thanks, Ludo=E2=80=99.