Re: Greenspunning ML (revisited)



On Apr 28, 8:23 pm, Jon Harrop <j...@xxxxxxxxxxxxxxxxx> wrote:
danb wrote:
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.

Can you implement proper decision-tree-based optimizations by augmenting
Lisp with some kind of closed algebraic data types equivalent to ML's
variant types?

Yes. It can be done.

That is where the enormous performance advantages lie...

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..

ML's pattern matching was designed to make it easy to convey
statically-checked constraints. I assume your Lisp implementation makes no
attempt to provide any static assurances at all. In which case, you may
find it more productive to Greenspun Mathematica's pattern matching
instead.

Of course the OP library does not implement the full blown unification
based ML type checking algorithm. It is because pattern (unification)
matching is a component (arguably the most important) of static type
checking. In other words, they are different things.

Cheers
--
Marco



.



Relevant Pages

  • Re: Speeding up an application - general rules
    ... I will also review those URLS. ... The file names and matching patterns are returned to the ... "find" command which is piped to sed to correct patterns that match ...
    (comp.lang.perl.misc)
  • Re: Greenspunning ML (revisited)
    ... to be embedded in individual branches where alternative patterns are ... Lisp with some kind of closed algebraic data types equivalent to ML's ... ML's pattern matching was designed to make it easy to convey ... statically-checked constraints. ...
    (comp.lang.lisp)
  • Re: Speeding up an application - general rules
    ... The file names and matching patterns are returned to the ... the script uses perl's system command to run a long winded ...
    (comp.lang.perl.misc)
  • Re: Speeding up an application - general rules
    ... Server's NFS file system. ... The file names and matching patterns are returned to the ... the script uses perl's system command to run a long winded ...
    (comp.lang.perl.misc)
  • [announce] gpicker -- a tool to quickly choose file in project by typing few keys
    ... I've recently released gpicker 1.0. ... Files are searched by their basename, but patterns containing '/' ... automagically turn on matching of directory name. ... which on cold machine and large project ...
    (comp.emacs)