Reading/printing Maxima exprs WAS: evaluate Maxima string from lisp command line...



> [New macsyma-read-string] seems to work in gcl, clisp and cmucl
:-)....
> Should this be put in contrib or replace the current definition?

Thanks for the testing.  The new version is not compatible with the old
one, and I see that there are a few places in the code which use it
(though I apparently never exercise them, since the existing m-r-s is
broken).  I suppose there should be a compatibility version
(macsyma-read-string) and a clean version (maxima-read-string, say).
I'll write them, and then I'd suggest they replace the current
definition.

> which are the functions I would use to convert that back into 2D text?

There are three basic ones:

    1D: mstring converts to a simple one-dimensional form
    1D: strgrind uses newlines and indentation to format nicely
        (doesn't do much of interest for math expressions, but 
        useful for code)
    2D: displa prints

mstring and strgrind return lists of characters which can be imploded or
printed; displa actually outputs; the lower-level routine is
dimension... see displa for messy details of usage.  strgrind and
display are affected by line length (linel).  There are various globals
for adjusting the output.  All three use nformat to preprocess, so that
x^-1 prints as 1/x etc.

Note that reading back the output does not get you exactly the same
thing.  Besides dropping internal flags (simp etc.), you can't tell that
an expression was CRE (rat/taylor).  So cut and paste is not completely
right -- but it is pretty close.

     -s