Robert Dodier | 15 May 05:57
Picon

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

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
Richard Fateman | 15 May 06:19
Picon
Favicon

Re: 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,
(Continue reading)

Dave | 15 May 07:52
Picon

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

On Wed, May 14, 2008 at 09:19:07PM -0700, Richard Fateman wrote:
> 
>
>> -----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. 
>
(Continue reading)

Stavros Macrakis | 15 May 16:03
Picon
Favicon

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

On Thu, May 15, 2008 at 1:52 AM, Dave <dfeustel <at> mindspring.com> wrote:
> On Wed, May 14, 2008 at 09:19:07PM -0700, Richard Fateman wrote:
>>> 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.

Algebraic pattern matching is different from generic tree pattern matching.

>>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.
>>...The situation is not entirely different if you substitute Python for FORTRAN.

Not true.  Python, Java, and C++ are perfectly fine manipulating tree
structures.  Of those, though, the only one really plausible as an
interactive language is Python. You could even write (quite
straightforwardly) code to translate between Maxima-style arithmetic
tree structures to Python-like arithmetic tree structures and back, if
you wanted to (say) evaluate numerically in Python.  Not entirely
clear why you'd want to do that though -- Python arithmetic is slower
than translated Maxima code and much slower than compiled Maxima code.
(I haven't done the test, but I've seen benchmarks.)

>>And if use another language for the top level, you need to deal with quoting and evaluation.

Agreed.

>>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
(Continue reading)

Barton Willis | 15 May 17:15
Favicon

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

For "Python-On-Lisp: unleashing Python libraries in Common Lisp," see

     http://common-lisp.net/project/python-on-lisp/

With GCL, I'd guess that this would not work :(

Some questions:

(1) Has anybody experimented with changes to Maxima (meval, mset,
... ?) that would give Maxima lexical scope? Or maybe optionally give
Maxima lexical scope? How much effort would be required? How much of
the share would be broken?

(2) Are some Maxima features (the fact database, contexts, the values
list, ...) incompatible with lexical scope?

Barton
Richard Fateman | 15 May 17:46
Picon
Favicon

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


Readers of Stavros' note may be assuming that a lisp pointer is the same as
a C pointer, which it may not be.
After all, the Lisp pointers may (and often do) have type tags, and may be
shifted since they
do not need to point to bytes, but to double-words (etc).

Since C is used to implement Lisp in most instances, C can do the job, with
some effort.

> -----Original Message-----
> From: macrakis <at> gmail.com [mailto:macrakis <at> gmail.com] On 
> Behalf Of Stavros Macrakis
> Sent: Thursday, May 15, 2008 7:04 AM
> To: Dave
> Cc: Richard Fateman; maxima <at> math.utexas.edu; Robert Dodier
> Subject: Re: [Maxima] Python vs Lisp: was RE: how to pass the 
> name of a variable as argument?
> 
> On Thu, May 15, 2008 at 1:52 AM, Dave <dfeustel <at> mindspring.com> wrote:
> > On Wed, May 14, 2008 at 09:19:07PM -0700, Richard Fateman wrote:
> >>> 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.
> 
> Algebraic pattern matching is different from generic tree 
> pattern matching.
(Continue reading)

ahmet alper parker | 18 May 14:07
Picon

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

If this is so stupid, I am sorry :) I see matlab working with mapple on symbolic computation issues. Why not make it same for octave and maxima? Can we use octave as the language? (Or how they do it in matlab?).
Regards...
Ahmet Alper Parker

On Thu, May 15, 2008 at 5:46 PM, Richard Fateman <fateman <at> cs.berkeley.edu> wrote:

Readers of Stavros' note may be assuming that a lisp pointer is the same as
a C pointer, which it may not be.
After all, the Lisp pointers may (and often do) have type tags, and may be
shifted since they
do not need to point to bytes, but to double-words (etc).

Since C is used to implement Lisp in most instances, C can do the job, with
some effort.


> -----Original Message-----
> From: macrakis <at> gmail.com [mailto:macrakis <at> gmail.com] On
> Behalf Of Stavros Macrakis
> Sent: Thursday, May 15, 2008 7:04 AM
> To: Dave
> Cc: Richard Fateman; maxima <at> math.utexas.edu; Robert Dodier
> Subject: Re: [Maxima] Python vs Lisp: was RE: how to pass the
> name of a variable as argument?
>
> On Thu, May 15, 2008 at 1:52 AM, Dave <dfeustel <at> mindspring.com> wrote:
> > On Wed, May 14, 2008 at 09:19:07PM -0700, Richard Fateman wrote:
> >>> 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.
>
> Algebraic pattern matching is different from generic tree
> pattern matching.
>
> >>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.
> >>...The situation is not entirely different if you
> substitute Python for FORTRAN.
>
> Not true.  Python, Java, and C++ are perfectly fine manipulating tree
> structures.  Of those, though, the only one really plausible as an
> interactive language is Python. You could even write (quite
> straightforwardly) code to translate between Maxima-style arithmetic
> tree structures to Python-like arithmetic tree structures and back, if
> you wanted to (say) evaluate numerically in Python.  Not entirely
> clear why you'd want to do that though -- Python arithmetic is slower
> than translated Maxima code and much slower than compiled Maxima code.
> (I haven't done the test, but I've seen benchmarks.)
>
> >>And if use another language for the top level, you need to
> deal with quoting and evaluation.
>
> Agreed.
>
> >>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).
>
> Python actually has all this, though not as conveniently
> accessible as in Lisp.
>
> > In view of your interest in pattern matching, I suggest
> Snobol4 as a possible front end for Maxima. Snobol4 is the
> best pattern matching and manipulation language I have used.
>
> Snobol4 has a very nice way of writing quite general backtracking
> pattern-matchers for strings. Though I suppose you can use its
> succeed/fail system in combination with its data structure facility to
> do pattern matching on trees, that would be a silly thing to do, as it
> is easy enough to write a backtracking pattern matcher in Lisp.  Or
> you could treat arithmetic expressions as strings -- but that would be
> insane.
>
> All in all, though I think Python is a better language in many ways
> than the current Maxima language, I don't think that it could be used
> directly, though there is certainly a lot to learn from it.
>
>          -s
>
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Robert Dodier | 20 May 06:51
Picon

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

On 5/18/08, ahmet alper parker <aaparker <at> gmail.com> wrote:

> If this is so stupid, I am sorry :) I see matlab working with mapple on
> symbolic computation issues. Why not make it same for octave and maxima? Can
> we use octave as the language? (Or how they do it in matlab?).

Well, I don't see much value in replacing the Maxima user
language with Matlab syntax. I guess it is a little more well-known
but it's an ad-hoc language just like Maxima's.

However one feature of Matlab that I find very useful is the
submatrix-indexing stuff, e.g. a[i, :] yields all elements in a row
and a[:, j] yields all elements in a column, x[L] yields selected
elements where L is a list of zeros and ones. I think there are
maybe one or two other such constructs. I attempted to replicate
that in Maxima, with some success, in the amatrix add-on package
which I committed to maxima/share/contrib, but replacing the lone
colon with the symbol 'all, and the 0/1 selection by false/true.

FWIW

Robert
Richard Fateman | 20 May 15:28
Picon
Favicon

Re: Python vs Lisp: was RE: how to pass the name of avariable as argument?

1. It would presumably appeal to Matlab (or Octave) users to have a "Maxima
symbolic toolkit"
that accesses some part of Maxima, just as the existing Matlab has a
"(Maple) symbolic toolkit".
This would introduce Maxima to a whole additional group of users, a
different prospect from
introducing a different syntax to the existing Maxima user community.
Matlab syntax is not just "a little more well-known".  It is a lot more
well-known.

2. The commercial Macsyma has a switch that allows Matlab syntax; in
particular the colon syntax.
Doing the same kind of thing for Maxima should not be difficult.

RJF

> -----Original Message-----
> From: maxima-bounces <at> math.utexas.edu 
> [mailto:maxima-bounces <at> math.utexas.edu] On Behalf Of Robert Dodier
> Sent: Monday, May 19, 2008 9:51 PM
> To: ahmet alper parker
> Cc: maxima <at> math.utexas.edu
> Subject: Re: [Maxima] Python vs Lisp: was RE: how to pass the 
> name of avariable as argument?
> 
> On 5/18/08, ahmet alper parker <aaparker <at> gmail.com> wrote:
> 
> > If this is so stupid, I am sorry :) I see matlab working 
> with mapple on
> > symbolic computation issues. Why not make it same for 
> octave and maxima? Can
> > we use octave as the language? (Or how they do it in matlab?).
> 
> Well, I don't see much value in replacing the Maxima user
> language with Matlab syntax. I guess it is a little more well-known
> but it's an ad-hoc language just like Maxima's.
> 
> However one feature of Matlab that I find very useful is the
> submatrix-indexing stuff, e.g. a[i, :] yields all elements in a row
> and a[:, j] yields all elements in a column, x[L] yields selected
> elements where L is a list of zeros and ones. I think there are
> maybe one or two other such constructs. I attempted to replicate
> that in Maxima, with some success, in the amatrix add-on package
> which I committed to maxima/share/contrib, but replacing the lone
> colon with the symbol 'all, and the 0/1 selection by false/true.
> 
> FWIW
> 
> Robert
> _______________________________________________
> Maxima mailing list
> Maxima <at> math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
> 

Gmane