Re: Parallel Common-Lisp with at least 64 processors?



On 24 Giu, 09:29, p...@xxxxxxxxxxxxxxxxx (Pascal J. Bourguignon)
wrote:
Jon Harrop <j...@xxxxxxxxxxxxxxxxx> writes:
Pascal J. Bourguignon wrote:
Well ok. Indeed, lisp has no native pattern matcher. But it has
something better: smooth and easy meta-programming.

Mathematica has both pattern matching and easy metaprogramming. Could a next
generation Lisp also bundle both?

The question is still whether this is something that needs to be done
at the implementation level.

Most of lisp just doesn't need specific implementation support, but
can be implemented directly over a core lisp. (Without going down to
the theorical pure lambda calculus, you could implement CL just with
its 17 special operators, and all the rest implemented above them).

So the point is that if you, as a lisp programmer, feel the need for a
pattern matcher, then you can implement it yourself in lisp as a
library, and it will be as integrated to the language as any other CL
operator, such as CLOS or LOOP for example.

For a counter example, given that there is no (standard) primitive in
CL allowing us to access the underlying OS and FS, we cannot implement
(portably) lisp pathnames and I/O as a library over the OS and FS.
Instead, CL provides support for pathnames and I/O.

But I don't remember you citing any feature of pattern matching that
would need implementation level support. On the contrary, we have
the example of several pattern matcher libraries.

I'm inciting you to write it, because you seem to be almost alone
wanting to have it. The existing pattern matchers are used when they
are needed, but obviously most lisp programmers don't feel the need
for them in all circumstances.

--
__Pascal Bourguignon__

There is a pattern matching library in PLT Scheme.
I used it to implement the performance test example on the Qi website.
It works but it's quite slow (takes about 20 seconds to complete the
test on my Pentium 4 3 Ghz):

(require (lib "match.ss"))

(define simplify
(match-lambda
((op a b) (s op (simplify a) (simplify b)))
(a a)))

(define s
(match-lambda*
(('+ (and m (? number?)) (and n (? number?))) (+ m n))
(('+ 0 f) f)
(('+ f 0) f)
(('+ a ('+ b c)) (simplify (+ (+ a b) c)))
(('* (and m (? number?)) (and n (? number?))) (* m n))
(('* 0 f) 0)
(('* f 0) 0)
(('* 1 f) f)
(('* f 1) f)
(('* a ('* b c)) (simplify (* (* a b) c)))
((op a b) (list op a b))))

(define (tt)
(time (test 10000000)))

(define (test n)
(if (zero? n)
0
(begin (simplify '[* x [+ [+ [* 12 0] [+ 23 8]] y]]) (test (- n
1)))))

.



Relevant Pages

  • Re: Why Lisp is too hard for me to use
    ... Lisps and several libraries. ... so it needs implementation support. ... The current strong support for Lisp ... > This consists of simple .tar.gz packages, ...
    (comp.lang.lisp)
  • Re: Another poll: Why you do not use Lisp?
    ... It has not enough support for modern programming ... It is socially inadequate (small, ... Lisp is that syntax repulses them, howevever, Lisp do ... Libraries are less important, because for every ...
    (comp.lang.lisp)
  • 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)

Loading