Subject: evaluate Maxima string from lisp command line...
From: C Y
Date: Thu, 4 Mar 2004 23:49:00 -0800 (PST)
--- Stavros Macrakis <stavros.macrakis@verizon.net> wrote:
> > ...how to take a string in regular maxima input format,
> > and feed it to Maxima on the lisp level
>
> In other words, you want to parse a string as Macsyma language. The
> macsyma-read-string function is supposed to do this, but doesn't work
> in 5.9.0/GCL. It also has no error handling. I have rewritten it
> from scratch. Give it a whirl.
>
> (meval (macsyma-read-string "diff(x^2,x)"))
> => ((MTIMES SIMP) 2 |$x|)
Seems to work in gcl, clisp and cmucl :-). Thanks much! Should this
be put in contrib or replace the current definition?
I guess I might as well as the logical followup question - once the
(meval (macsyma-read-string()) event has returned it's output, which
are the functions I would use to convert that back into 2D text?
Basically the idea would be something like:
a) Accept input string from interface and evaluate it
- (meval (macsyma-read-string ))
- store this form internally as the answer, and convert it on the
fly for display into whatever form in step:
b) call function using result of a) as input and get formatted output
object as return - either output directly as 2D text, or in a more
capable interface call a different function for more complex
output.
With the internal stored format the result of a) rather than the text
of b, any cut and past operations to any other input lines can
automatically do the right thing - if a 2D text output is selected the
past operation would be the 1D version for an input text cell, for
example.
Formatted output commands would have to be specially implimented in
Maxima in order to take advantage of Maxima's knowledge of how to
resize math expressions, but otherwise it could be the job of the
interface to send either regular text or something meval can handle.
And hopefully sending either meval or macsyma-read-string information
down a server pipe wouldn't put a strain on any OS's abilities.
(Formatted output might be a little trickier, but I'm hoping it will be
mainly a matter of sending font information and proper notification of
subexpression organization as some kind of tags.
CY
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html