[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] match.scm



Hi,

[CCing scheme-reports, which is the public discussion list
for the upcoming Scheme standard.  The R6RS list is
better suited for discussion of R6RS-specific issues.]

On Wed Dec 15 05:25:45 EST 2010, Peter Kourzanov wrote:

> On Wed, 2010-12-15 at 02:45 -0500, John Cowan wrote:
>> Be sure to look at http://synthcode.com/scheme/match.scm as
>> well.
>
> A quick look reveals that this matcher is very promising and
> written in a very clean way using R5RS only. It does have the
> following properties:

Note that I chose the Wright syntax because I had existing code
using that syntax, which has its advantages and disadvantages.  I
would not necessarily choose the same syntax producing a standard
from scratch.

> * missing struct/records support? I think we should specify it,
> and let implementations decide on its efficient representation

These are actually commented out in the source.  The upstream
chibi-scheme version has support for matching SRFI-99 records.

> * at some point, it does vector->list for matching inside
> quasiquote.  Isn't it a bit inefficient?

Vectors in general are rare to match against - a lot of matching
libraries use that trick for matching even outside of quasiquote.
It's easy enough to optimize if you feel the extra code is worth
it.

> * are nested ellipses supported? Looks like they are quite
> useful...

Please read the comment in the source regarding this - they are
intentionally disabled.

Nested tree patterns aren't disabled, though,

> * (? predicate) matching is a bit ugly when you use (? number?).
> Reminds me of Bigloo/Queinnec's matcher

Alternate syntax suggestions are welcome.

> * where are guards?

You can combine predicates and/or use the failure continuation.

> * matching numbers: we need to use (=) to match them, not equal?
> (or eqv? and eq?)

Do we? :)

-- 
Alex

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports