Re: Re: pointers in "RRRS Authors"
dvanhorn <[email protected]>
| Newsgroups | gmane.org.ballistichelmet.lambda |
|---|---|
| Message-ID | <[email protected]> |
Interesting pointers Aaron, thanks for posting them. If you come across
anything more let me know.
The following page documents the PLT pattern matching facility:
http://sol.cs.wcu.edu/~bhauman/scheme/pattern.php
I disagree with Haynes that printed (or external) syntax should be used. I
think a constructor syntax is much better because it closely resembles the
pattern matching mechanism in ML, and external syntax is not extensible (this
is the latest approach used by PLT in plt-match.ss). I do find the external
syntax convenient in places, but the clean solution is to specify the
constructor syntax and a translation from external to constructor syntax,
which is exactly what PLT's match.ss does; it compiles the external syntax
patterns into constructor based patterns. I also think any pattern matching
facility worth a lick will allow for the set of constructors to be extended
(which Haynes shies away from). SRFI-9, record types may be of use here but
the lacking piece is any kind of reflection upon type definitions. If SRFI-9
specified the value bound to the type as the simple and elegant recursive
definition mentioned in the reference implementation, it would be easy enough
to define a pattern matching facility that supported SRFI-9 records in plain
old r5rs+srfi-19.
There are tons of pattern matching libraries out there. I know Chez, PLT, and
Bigloo have distinct ones, and I'm sure many other Schemes do too. There's
also a pattern matching facility in EoPL, but I haven't looked at it in ages.
David