2010/10/13 Sunil S Nandihalli <sunil.nandiha...@gmail.com> > 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 as > > I know f is a function >
Here lies the problem. The f that is passed as an argument to the call to the macro Variable is not a function. It's the plain symbol f , within a plain list . If you want the macro to interpret the symbol f as a function (or rather the datastructure '(f) as a function call, then you'll have to evaluate it from the macro (which is probably possible and justified in you case because you do not want to distribute the mathematica stuff for the runtime, but it will be available when evaluating from inside the macro at compile time => I assume you will AOT compile things, of course). So in short: calling eval from the macro, on its argument. HTH, -- Laurent > 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.nandiha...@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 f >> >> any help is greatly appreciated. >> Thanks, >> Sunil. >> > > -- > 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<clojure%2bunsubscr...@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 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