lisp string to maxima expression



There is a problem (a bug?) in $parse-string from CVS:
(%i1) :lisp ($parse_string "x+5")
(%i1)
((MPLUS) $X 5)
(%i1)_
Same effect if I call $parse_string directly from Lisp: it's output first "(%i1)" then the parsed string. I gess it's OK when you work with Maxima from a console, but I use it in CGI so I get this "(%i1)" in generated HTML. How it can be disabled?
Yigal Asnis

Robert Dodier <robert.dodier at gmail.com> wrote: On 8/27/07, Yigal Asnis  wrote:

> I'm working on web site for interactive solving math problems using Lisp
> (clisp) as CGI.
>
> One thing I can't realize: I get Lisp input from CGI, say x^2+x+7. How can I
> convert it to Maxima expression for diff or solve?

Yigal, maybe the functions in share/contrib/eval_string.lisp are useful to you.
In Lisp you might do something like this:

;; assume s is bound to "x^2+x+7" or whatever
(load ($file_search "eval_string"))
;; just parse it
(format t "($parse_string ~s) => ~s~%" s ($parse_string s))
;; parse and evaluate it
(format t "($eval_string ~s) => ~s~%" s ($eval_string s))

I have just modified eval_string.lisp to accept Lisp strings as
well as Maxima strings. You can get the new version from CVS:
http://maxima.cvs.sourceforge.net/maxima/maxima/share/contrib/eval_string.lisp

Hope this helps,
Robert Dodier


       
---------------------------------
Luggage? GPS? Comic books? 
Check out fitting  gifts for grads at Yahoo! Search.