Hello everybody,
 I would like some help in writing a macro which accepts the return value
from mathematica and create a function in clojure which can be called. I am
kind of inexperienced writing macros.. I will try to describe what I have
done (does not work ) and request you all to help me modify it to do what I
was expecting of it.

I have set up clojure and clojuratica properly.

the results of evaluation of sexps are appended to the sexp

(mathematica-eval "D[x*x+y*x,x]") =>  (+ (* 2 x) y)  ;sexp1

(math (Variables (+ (* 2 x)  y))  => [x y] ;sexp2

and I was expecting the evaluation of the following

(math (Variables (mathematica-eval "D[x*x+y*x,x]")))

to return [x y] .. but I guess I am making a mistake with handling the
symbols.. I would like you to help me to make this work.

Finally, when I get a sexp from mathematica I would like to create a
function whose body is the returned sexp with all the unbound variables as
the arguments to the function. The following was my first attempt at
achieving the goal. which does not work.

(defmacro sexp2fn [sexp]
 `(fn ~(math `(Varaibles ~sexp))
        ~sexp))

assuming the above macro were correct .. I would like the macro expantion of
the following

(sexp2fn (mathematica-eval "D[x*x+y*x,x]"))

to return

(fn [x y] (+ (* 2 x) y)

can anybody help me achieve this.
Thanks for reading.
Sunil.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to