Maxima from Lisp



>>>>> "Steve" == Steve Haflich <smh at franz.com> writes:

    Steve>    From: Raymond Toy <raymond.toy at ericsson.com>
    Steve>    Perhaps this will give you some ideas:
   
    Steve>    (with-output-to-string (s)
    Steve>      (let ((*standard-output* s))
    Steve>        (maxima-display (add '$x (mul '$x '$x))))
    Steve>      s)

    Steve> The above is somewhat overcomplex.  The final s is pointless, since
    Steve> with-output-to-string returns the collected string, not the result of
    Steve> its progn body, and s would be the stream, not thje string..  Also,
    Steve> the extra variable can be eliminated, giving this:

    Steve>  (with-output-to-string (*standard-output*)
    Steve>    (maxima-display (add '$x (mul '$x '$x))))

Yes, you're correct.  This is much nicer.

I guess we should also say this works because maxima-display writes
its output to *standard-output* by default, but maxima-display takes a
:stream keyword arg to specify the output stream, so if you already
have some stream, you can redirect the output there.

Ray