[plt-scheme] The or-pattern in match.ss
On Jan 5, Matthew Flatt wrote:
> Someone should probably start over with Andrew's source. Any
> volunteers?
Well, I have a whole independent matching thing in Swindle,
http://www.cs.cornell.edu/eli/Swindle/extra-doc.html#matcher
The `matcher' form makes a function but there are other forms like
`match' etc. The code is definitely simpler than the one in mzlib
(only 75 lines), and includes only a few kludges for Swindle that
would be easy to remove. It creates an actual Scheme form from the
pattern, which is pretty simplistic, but I think it should generally
work pretty well. (The whole thing started with some small code I had
which was expanded later to counter example the fact that ML is so
great because some red/black tree code is so small...)
> (The slightly interesting part is making it work nicely with
> `define-struct'. I could probably find time to do that myself, if
> someone else does the rest of the work. Or I would be happy to merely
> offer advice.)
What I would really want to do is to have that code customizable so
you can register more pieces of matching forms. Then it would be
simple to have modules register new patterns, like object systems
etc.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!