On Mon, Sep 6, 2010 at 12:04 AM, Ludovic Courtès <l...@gnu.org> wrote:
>
> GNU Guile 1.9 now uses your implementation of ‘match’ as a nice
> replacement for Wright’s implementation, so thank you!
>
> I stumbled upon this incompatibility: Wright’s ‘match’ supports ‘..1’,
> ‘..2’, etc., which mean “1 or more”, “2 or more”, etc., and the
> associated variable (when there’s one) is bound to the list that
> matches:
>
>  (match '(a 1 2) (('a x ..1) x))
>  => (1 2)
>
> AFAICS these patterns aren’t implemented in your ‘match’.
>
> Do you have plans to implement them?

Yes, these can't be implemented in syntax-rules.

It would be straightforward to implement an alternate
syntax such as

  (match '(a 1 2) (('a x .. 1) x))

or generalize it to

  (match '(a 1 2) (('a x <M> .. <N>) x))

where the <N> could be #f or left out to mean infinity,
which would be strictly more powerful than Wright's
syntax.

The main reason I haven't bothered adding this is
I've never needed it, and was waiting to hear reports
from people who do.

Do you have any code which actually uses the ..k
patterns? :)

-- 
Alex

Reply via email to