Greenspunning ML (revisited)



Well, I didn't like any of the pattern-matching libraries out there,
so I wrote another one. The api is similar to Fare Rideau's fare-
matcher, with a couple extra features, but the internals are much more
straightforward, at the expense of not supporting unification at all.

Incidentally, the title of this post is derived from a message I
posted here a few months ago, forwarding a message from Fare about
fare-matcher. c.l.l had recently been engaged in a troll war with Dr.
Frog, who had claimed that pattern matching in Lisp amounted to
Greenspunning ML. The title was meant to be a parody of Dr. Frog, but
maybe some people took it otherwise (if they noticed it). Anyway,
since I so rudely inflicted such an inconsiderate title on a post
about Fare's software, the least I could do was to take a well-
deserved dose of my own medicine.

So this library is called cl-match, and it uses the same s-expression
interface to ML-style matching as does fare-matcher, but it has a
couple extra features. It allows multiple occurances of variable
names, with implied EQL comparisons, and allows branch-specific guards
to be embedded in individual branches where alternative patterns are
allowed (OR patterns). The expanded code is optimized somewhat by
testing all single-branch patterns first. There's some documentation
here:

http://www.prairienet.org/~dsb/clmatch.htm

The main page has links to a user's manual, a page on the internals,
and a download directory. Please feel free to comment, criticize,
point out bugs, etc..

--Dan

------------------------------------------------
Dan Bensen
http://www.prairienet.org/~dsb/
.



Relevant Pages

  • Re: A request for information please.
    ... is so much matching patterns to solve, lets say, survival in hostile ... I wouldn't say I was pattern matching, in fact its the opposite, ... you are searching for patterns which your brain will see as valuable. ... to follow it, but when we mess up and fail to follow the plan, we sometimes ...
    (comp.ai.philosophy)
  • Re: 10 ten things any good programmer can/has done?
    ... >> Cond is a rudimentary precursor of pattern matching where all patterns ... > programming language construct that you feel comfortable with. ... that is a special case of pattern matching called "guarded patterns". ...
    (comp.programming)
  • Re: Formal and informal type systems?
    ... > Will your Patterns handle argument pattern matching like in the ... But I have no beef conceding that ML is better at this than Ada. ...
    (comp.lang.ada)
  • Re: Reconsidering assignment
    ... I prefer to see explicit ADT with its ... BTW, what is the problem argument pattern matching is supposed to solve? ... Comparing patterns is far more difficult. ...
    (comp.lang.ada)