Hi,
On 13 Okt., 11:19, Sunil S Nandihalli <[email protected]>
wrote:
> (defmacro sexp2fn [sexp]
> (let [sym (eval sexp)
> vars (eval (math (Variables sexp)))]
> (println [sym vars])
> `(fn ~vars
> ~sym)))
Try the following:
(defn evaled-variables
[form]
(eval `(math (Variables ~form))))
(defmacro sexp2fn
[string]
(let [form (mathematica-eval string)
vars (evaled-variables form)]
`(fn ~vars ~form)))
Using my previous stubs I get:
user=> (macroexpand-1 '(sexp2fn 2))
(clojure.core/fn [x__1__auto__ y__2__auto__] (clojure.core/+
x__1__auto__ (clojure.core/* 2 y__2__auto__)))
You would call it (sexp2fn "D[x*x+x*y,x]").
Hope that helps.
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en