Re: Unlearning Pattern Matching



On 30 jun, 10:14, Jon Harrop <j...@xxxxxxxxxxxxxxxxx> wrote:
André Thieme wrote:
Jon Harrop schrieb:
Dan Bensen wrote:
This ML-style pattern matcher takes just a few hours to write...

A good educational exercise but Greenspun.

Why is it Greenspun?

He is reimplementing half of a modern FPL (the pattern matcher). The
implementation is ad-hoc (not even a feature list) and if it took a few
hours then he most likely didn't read any of the research that has been
done in this area. There is no specification. The implementation doesn't
affect the compiler's optimizer, so it will be comparatively slow.

So we have:

ad-hoc
informally-specified
bug-ridden
slow

reimplementation of half of OCaml/SML/Haskell/F#/Scala/.

The pattern matchers in these languages are well-specified, mature and fast.
So lashing together something that looks similar is classic Greenspun. That
doesn't stop it from being a good educational exercise, of course, but the
proof is in the pudding so Dan might like to benchmark his implementation
against some of the major players.

--
Dr Jon D Harrop, Flying Frog Consultancy
The OCaml Journalhttp://www.ffconsultancy.com/products/ocaml_journal/?usenet

The book "Lisp in small pieces" LISP
of C.Queinnec give some good examples of pattern-matching and
filtering and
construct an interface for a natural robot language.
The examples are in lisp but not common lisp.

http://www-spi.lip6.fr/~queinnec/WWW/LiSP.html

.



Relevant Pages

  • Re: Pattern Matching and Transform Rules
    ... Perhaps he was not aware that the mathematica pattern matcher was based on ... is given in open-source lisp code in MockMMA. ... We are talking about a recursive application of the language which is used to examine and transform expressions written in the language under consideration. ...
    (sci.math.symbolic)
  • Re: Parallel Common-Lisp with at least 64 processors?
    ... can be implemented directly over a core lisp. ... would need implementation level support. ... the example of several pattern matcher libraries. ... matching libraries and the ability to Greenspun their own. ...
    (comp.lang.lisp)
  • Re: Does ANSI Common Lisp have pattern matching?
    ... ubiquitous in languages that support it. ... standard pattern matcher in the next version of Lisp. ... A pattern matcher is essentially a glorified if statement. ... Common Lisp Document Repository: http://cdr.eurolisp.org ...
    (comp.lang.lisp)
  • Re: Parallel Common-Lisp with at least 64 processors?
    ... generation Lisp also bundle both? ... CL provides support for pathnames and I/O. ... the example of several pattern matcher libraries. ...
    (comp.lang.lisp)

Loading