(defmacro zzz [form]
(first form))
(defmacro eval-zzz [form]
`(zzz ~(eval form)))
rlm.play-all> (zzz (range 1 2))
#<core$range clojure.core$range@61e066>
rlm.play-all> (macroexpand-1 '(eval-zzz (range 5)))
(rlm.play-all/zzz (0 1 2 3 4))
rlm.play-all> (eval-zzz (range 5))
0
--Robert
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
as a follow up with further clarifications, I would like to mention that Variables is already a predefined macro and I don't want have to execute it at run-time since it uses mathematica and we cannot distribute mathematica to the end user.and also please read my last sentence asI know f is a function
and will not be evaluated before the macro expands.. may be there is a way to wrap it in a macro (since f is already defined which I would like to use) and have the macro Variables apply on the result of evaluation of f
it was a typo in my earlier email.
On Wed, Oct 13, 2010 at 11:25 AM, Sunil S Nandihalli <sunil.na...@gmail.com> wrote:
Hello Everybody,I think I was not clear about things in my previous email.. I am reposting simplifying things...
Variables is a macro which works in the following way..(Variables (+ x (* 2 y))returns[x y]now let us say we have a function(defn f []'(+ x (* 2 y)))now I would like to do something like(Variables (f))which would return[x y]I know if is a function and will not be evaluated before the macro expands.. may be there is a way to wrap it in a macro (since f is already defined which I would like to use) and have the macro Variables apply on the result of evaluation of fany help is greatly appreciated.Thanks,
Sunil.