[plt-scheme] New Match Implementation

From: Sam TH (samth at ccs.neu.edu)
Date: Wed Mar 26 10:54:57 EDT 2008

I've just changed the implementation of the various pattern matching
libraries in PLT (scheme/match, mzlib/plt-match, mzlib/match) to a
new, from-scratch implementation.  This new implementation should have
significantly faster compile times, especially with complicated match
expressions.

There are two backwards-incompatible changes:

- `set!' and `get!' patterns have been removed.  In earlier discussion
on this list, it seems that they are completely unused, and they would
be very difficult to support in the new implementation.
- `list' and `vector' patterns with ... are no longer quite as greedy.
 They will now match as many elements as possible, but not so many
that the pattern as a whole fails to match.  For example:

   (match '(1 2 3 4 5)
     [(list x ... 5) x])

succeeds, and produces (1 2 3 4).  Such patterns now have the
semantics of the Kleene * operator in regular expressions.

There are two other, backwards-compatible changes:

- There is now an `mcons' pattern, for matching mutable pairs.  It
works similarly to the existing `cons' pattern.
- There is now a `list*' pattern, taking the place of `list-rest'.
The `list-rest' pattern is still accepted, but deprecated.

Further improvements to the library are planned, and suggestions are
always welcome.

Thanks,
-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.