Re: Does ANSI Common Lisp have pattern matching?



Jon Harrop wrote:
Pascal Costanza wrote:
Jon Harrop wrote:
The fact is, pattern matching is more common that mapcar. It is
ubiquitous in languages that support it. I think that warrants putting a
standard pattern matcher in the next version of Lisp.
A pattern matcher is essentially a glorified if statement.

No, because "if" statements do not deconstruct. Pattern matching replaces
if/cond/car/cdr/destructuring-bind with a single unified construct that
encourages high-level programming, making for simpler and faster code.

What part of "glorified" is it that you didn't understand?

Pattern matchers are indeed more useful for languages with static type systems where at runtime you
cannot refer to the type of a value anymore.

Scheme and F# are obvious counter examples. F# provides run-time type
information yet pattern matching remains ubiquituous, precisely because it
is so useful and cannot be represented using dynamic dispatch and types.

How do you know that anything in F# is ubiquitous? It only exists for three years now...

I have no experience from CLOS but, from what I have heard, it is extremely
slow.

Maybe you should check your hearing, then.


Pascal

--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
.



Relevant Pages

  • Re: Unlearning Pattern Matching
    ... He is reimplementing half of a modern FPL (the pattern matcher). ... implementation is ad-hoc and if it took a few ... The book "Lisp in small pieces" LISP ... construct an interface for a natural robot language. ...
    (comp.lang.lisp)
  • 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: 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)
  • When static typing is worth it
    ... typed languages like Lisp. ... developed more quickly in modern statically typed languages than ... static type system and remove run-time checks. ... incurs a run-time error if the list is ...
    (comp.lang.lisp)

Loading