I have a macro, deriv, that produces an expression, and I'd like to
create another macro that turns this into a function.  So far I have

(defmacro deriv-fn [fn-args exp v degree]
  `(fn ~fn-args (deriv ~exp ~v ~degree)))

Which of course doesn't work, since it considers the output of deriv
as a quoted list.  So for instance

(def f (deriv-fn [x y]  (+ (* x y) (* 3 y)) y 1))

results in a function f of two variables which always returns '(+ x
3) , rather than a function which evaluates (+ x 3).

I feel like this is a nested backquote thing, where I could get it to
resolve at the correct point through artful use of ` and ~~, but I've
not been able to figure it out - am I on the right track?

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