pattern-matching? Per Bothner 10 Mar 2006 17:17 UTC

How difficult would it be to extend the matcher to pattern matching?
Ignore issue of syntax, I imagine a special kind of "pattern variable box".
When the pattern variable box is matched against a Scheme value, then
the match always succeeds, and the value is saved in the box, where it
can be used later.

A useful extension is to allow the pattern variable box to have a type
predicate: basically any one-argument function.  In that case the match
only succeeds if the applying the predicate to the variable returns true.

And then the extension I really want: sub-sequence matching.  I.e. matching
of regular trees.  Basically pattern boxes that match a variable number of
elements in a list or vector.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/