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

pattern-matching?

This page is part of the web mail archives of SRFI 85 from before July 7th, 2015. The new archives for SRFI 85 contain all messages, not just those from before July 7th, 2015.



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
per@xxxxxxxxxxx   http://per.bothner.com/