[plt-scheme] MrMathematica

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Thu Jun 10 08:54:03 EDT 2004

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))

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


Posted on the users mailing list.