unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Alex Shinn <alexshinn@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guile-devel@gnu.org
Subject: Re: ‘match’ and “k or more” patterns
Date: Wed, 8 Sep 2010 11:18:18 +0900	[thread overview]
Message-ID: <AANLkTikKbVssXkdfc=DnKgEJr2xJxsNrbjL1vifqkYV2@mail.gmail.com> (raw)
In-Reply-To: <874oe36pgn.fsf@gnu.org>

On Mon, Sep 6, 2010 at 9:12 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>
> Well, since there are only 9 of them, they could probably be implemented
> as special cases, with an augmented ‘match-gen-ellipses’, which would be
> told the minimum number of elements expected?

Oh, the Wright syntax limited you to 9 forms, so "..10" is illegal?

Then this could be done in pure syntax-rules.

>> Do you have any code which actually uses the ..k
>> patterns? :)
>
> I do!  :-)
>
>  http://git.sv.gnu.org/cgit/guile-rpc.git/tree/modules/rpc/compiler.scm#n312
>
> Well it uses only ‘..1’.  The same code would work with ‘..1’ replaced
> by ‘...’, but then errors in the input wouldn’t be detected as nicely.

"..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.

-- 
Alex



  reply	other threads:[~2010-09-08  2:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-05 15:04 ‘match’ and “k or more” patterns Ludovic Courtès
2010-09-06  1:46 ` Alex Shinn
2010-09-06 12:12   ` Ludovic Courtès
2010-09-08  2:18     ` Alex Shinn [this message]
2010-09-08 12:06       ` Ludovic Courtès
2010-09-08 18:53       ` Andy Wingo
2010-09-19 21:30       ` Ludovic Courtès
     [not found]         ` <2083922817.3379621.1285477344869.JavaMail.root@zmbs1.inria.fr>
2010-09-27 21:56           ` Ludovic Courtès
2010-09-28  1:20             ` Alex Shinn
     [not found]             ` <704726234.3471946.1285636813715.JavaMail.root@zmbs1.inria.fr>
2010-09-28 10:27               ` Ludovic Courtès
2010-10-02  7:13                 ` Alex Shinn
2010-10-03 10:24                   ` Andy Wingo
     [not found]                   ` <2087670639.297243.1286101256715.JavaMail.root@zmbs1.inria.fr>
2010-10-03 12:35                     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTikKbVssXkdfc=DnKgEJr2xJxsNrbjL1vifqkYV2@mail.gmail.com' \
    --to=alexshinn@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).