On 2013-03-28, Mohamed Omar Rayes <rayes.o.mohamed at gmail.com> wrote:
> LispObject sin_exp = I.eval("'((%SIN) $X)");
Changing %SIN to MAXIMA::%SIN in the line above yields the expected output:
loading Maxima ... finished.
#<$DIFF {2CD5A3}> was found $X
$X
((MAXIMA::%SIN) $X)
((%SIN) $X)
((MAXIMA::%COS MAXIMA::SIMP) $X)
((%COS SIMP) $X)
The problem is that $DIFF doesn't know anything about CL-USER::%SIN,
only MAXIMA::%SIN (a different symbol).
It doesn't seem to matter whether $X is interned in package :maxima or
package :cl-user, but you must be consistent (always the one or always
the other).
There is some tension in a program like yours between having the Lisp
parser construct expressions for you, and constructing them yourself via
CONS. Punting to the Lisp parser may sound more convenient, but in any
interesting problem, the structure isn't fixed, so you would have to
have your own data structure and then stringify it as an S-expression.
So that might be more trouble, actually, than just consing it up.
Best of luck, & keep up the good work.
Robert Dodier