From: Raymond Toy <raymond.toy at ericsson.com>
Perhaps this will give you some ideas:
(with-output-to-string (s)
(let ((*standard-output* s))
(maxima-display (add '$x (mul '$x '$x))))
s)
The above is somewhat overcomplex. The final s is pointless, since
with-output-to-string returns the collected string, not the result of
its progn body, and s would be the stream, not thje string.. Also,
the extra variable can be eliminated, giving this:
(with-output-to-string (*standard-output*)
(maxima-display (add '$x (mul '$x '$x))))