Python vs Lisp: was RE: how to pass the name of a variable as argument?



 

> -----Original Message-----
> From: Robert Dodier [mailto:robert.dodier at gmail.com] 
> Sent: Wednesday, May 14, 2008 8:58 PM
> To: Dave
> Cc: Richard Fateman; maxima at math.utexas.edu
> Subject: Re: [Maxima] Python vs Lisp: was RE: how to pass the 
> name of a variable as argument?
> 
> On 5/14/08, Dave <dfeustel at mindspring.com> wrote:
> 
> > Would using Haskell for the top level be feasible?
> 
> That seems interesting, mostly, from my point of view, because
> Haskell has built-in pattern matching. I don't know anything about
> it, but it seems likely it is more powerful than Maxima's pattern
> matching.

Does Haskell's pattern matching include rational simplification and
knowledge of identities under addition and multiplication?  
There are 3 pattern matchers in Maxima, and another could be loaded in
(corresponding approximately to the pattern matcher in Mathematica version
3.0).

One issue with taking a language that you like and having it "call Maxima"
is that most languages cannot do much of anything with the return value
unless the return value is numeric. 

Thus it is entirely possible, in some circumstances,  for FORTRAN to call
Maxima.  But if the answer is, say,
x^2+sin(y+3.141592623442343423424234324343423234234342423)

what is FORTRAN going to do? 
Deconstruct an algebraic tree?
Take the answer as a string and, uh, reparse it, turning it into an
algebraic tree?
Print it out?

The situation is not entirely different if you substitute Python for
FORTRAN.

And if use another language for the top level, you need to deal with quoting
and evaluation. Lisp knows about symbols and such. There is a symbol table
that lives at run-time.  This is very handy for symbolic math.
Some languages do not have such a run-time structure, or if they do, it is
not easily accessible to the programmer (that is, it is used by the
debugger). I don't know how these issues are addressed in Haskell.
RJF
> 
> If there were an implementation of Haskell in Lisp, it would
> theoretically be straightforward to try it -- just launch Maxima
> and load Haskell into the image and somehow call a Maxima
> function from Haskell ... If you have time to try it,
> I would be interested to hear how it turns out.
> 
> best
> 
> Robert Dodier
>