# [plt-scheme] MrMathematica

======= 2004-06-10 20:54:03 Shriram Krishnamurthi =======
>*Hi --
*>*
*>*Nice work!
*>*
*>*Have you considered writing some macros instead? That way you can
*>*better check the syntactic structure of inputs you send to
*>*Mathematica. If you do this, I strongly encourage you to adopt Olin
*>*Shivers's "quasiquoted macro" convention, where the macro is
*>*implicitly quasiquoted rather than quoted. That way if you never
*>*unquote it looks the same as if it were quoted, while you still leave
*>*the power to unquote within the macro body. (Scsh has several
*>*examples of this form.)
*>*
*>*It is neat that you can use the output of Mathematica to define new
*>*Scheme functions:
*>*
*>>* (define f (matheval '(Integrate (expt x 2) x)))
*>>* f
*>*(* 1/3 (expt x 3))
*>>* (define s (eval `(lambda (x) ,f)))
*>>* (- (s 1) (s 0))
*>*1/3
*>*
*>*It would be nice if, eventually, the result were automatically a
*>*Scheme function, or at least an object that can be treated both
*>*sytactically (if you just want to view it textually) and as a
*>*function, so you don't need to write
*>*
*>*(define s (eval `(lambda (x) ,f)))
*>*
*>*Is Mathematica designed to be use this way? Does it behave well when
*>*embedded?
*>*
*>*Shriram
*>*
*
I get your meaning. But I can't do that. I have to call Mathematica, and
the return expression from Mathematica is already symbol based.
Zhu Chongkai
http://www.websamba.com/mrmathematica