> When I copy the definition of drive-fn from your link above and then > invoke macroexpand-1, I get: > user=> (macroexpand-1 '(deriv-fn [a b c] foo bar baz)) > (user/deriv-fn* (quote [a b c]) (quote foo) (quote bar) baz) > > First step is to find out why you aren't getting the same expansion. > FWIW, I'm running clojure 1.1.0 on Mac OS X Leopard, from the command > line.
The output is different because you're using my version of the defn-fn macro, which I checked in late this afternoon. > (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). My solution to this was to walk the tree returned by deriv and replacing the symbols for functions (i.e. +, -, sin, cos, etc) with their fully qualified names (ie. clojure.core/+, incanter.core/sin, etc), and replacing variable symbols (i.e. x y) with gensym-ed versions. David > > -Doug > > -- > 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 > athttp://groups.google.com/group/clojure?hl=en -- 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