Maxima + Java



> You might have Maxima return stuff as an S-expression. I 
> believe a parser for such stuff would be easy to write in 
> Java. In the name of all that is good, do not pass XML back 
> and forth....

The advantage of XML is that it is standard, and that parsers and other
tools are available everywhere.  I think it makes more sense to write
XML readers and printers for Lisp (in fact, I think they exist already)
than to try to get every other tool in the world (Java, Python, Perl,
C++, Visual Basic, Javascript, etc.) to implement Common Lisp
s-expression readers and printers (including string escape conventions,
capitalization conventions, rationals, #X(...) constructs, etc.).  I
suppose you could write a Maxima-subset reader/printer....

The main disadvantage of XML is that it can be extremely verbose.  It
bothers me aesthetically that it is so verbose.  But then, any textual
representation (s-expressions or XML) is verbose compared to a binary
fixed-field representation like ASN.1 or a binary packed-to-the-bit
encoding.

But XML doesn't have to be so verbose -- it all depends on the DTD.  You
have many choices in specifying a DTD for XML.  You could of course
mirror s-expression syntax directly, using <o>...</o> for (...) etc.,
but that would be silly.  You could use a standard mathematical
expression DTD like MathML, which is admittedly verbose.  This, I
suppose, matters if you are routinely exchanging huge symbolic
expressions.  If that's an issue, you could write a more compact
Maxima-specific DTD at the cost of losing easy interchange with other
CAS tools.

Now of course *syntactic* communication isn't enough -- the
communicating systems need to agree on what Integrate means, what INF
means, and all that.  But that is true whether the syntax is
s-expressions or an XML DTD.

A little verbosity is worth a lot of interchange.

       -s