--On 4 Mar 2014 23:07:27 -0800 milinda <milinda.pathir...@gmail.com> wrote:
I wanted macro to work like following.
(ffff (let [x 10] (+ x (defpop))))
This should generate function like
(defn execute [tu3455] (let [x 10] (+ x tu3455)))
Try this:
(defmacro ffff [body]
`(macrolet [(~'defpop [] 'tu#)] (defn execute [tu#] ~body)))
In action:
user=> (macroexpand-1 '(ffff (let [x 10] (+ x (defpop)))))
(clojure.tools.macro/macrolet [(defpop [] (quote tu__818__auto__))]
(clojure.core/defn user/execute [tu__818__auto__] (let [x 10] (+ x
(defpop)))))
user=> (macroexpand '(ffff (let [x 10] (+ x (defpop)))))
(do (def user/execute (fn* ([tu__818__auto__] (let* [x 10] (+ x
tu__818__auto__))))))
Konrad.
--
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
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.