[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ‘match’ and “k or more” patterns
From: |
Alex Shinn |
Subject: |
Re: ‘match’ and “k or more” patterns |
Date: |
Wed, 8 Sep 2010 11:18:18 +0900 |
On Mon, Sep 6, 2010 at 9:12 PM, Ludovic Courtès <address@hidden> 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
- ‘match’ and “k or more” patterns, Ludovic Courtès, 2010/09/05
- Re: ‘match’ and “k or more” patterns, Alex Shinn, 2010/09/06
- Re: ‘match’ and “k or more” patterns, Ludovic Courtès, 2010/09/06
- Re: ‘match’ and “k or more” patterns,
Alex Shinn <=
- Re: ‘match’ and “k or more” patterns, Ludovic Courtès, 2010/09/08
- Re: ‘match’ and “k or more” patterns, Andy Wingo, 2010/09/08
- Re: ‘match’ and “k or more” patterns, Ludovic Courtès, 2010/09/19
- Message not available
- Re: ‘match’ and “k or more” patterns, Ludovic Courtès, 2010/09/27
- Re: ‘match’ and “k or more” patterns, Alex Shinn, 2010/09/27
- Message not available
- Re: ‘match’ and “k or more” patterns, Ludovic Courtès, 2010/09/28