Re: Meta data access

2012-10-23 Thread Mamun
Hi Carlo, Thanks. Now it is fine. Regards, Mamun On Tuesday, October 23, 2012 5:24:41 AM UTC+2, Carlo wrote: > > Hey Mamun, > > Your problem is that your ^{:test true} metadata isn't being applied > to your functions, as you might expect, but rather to the var that is > pointing to the functi

Re: Meta data access

2012-10-22 Thread Carlo Zancanaro
Hey Mamun, Your problem is that your ^{:test true} metadata isn't being applied to your functions, as you might expect, but rather to the var that is pointing to the function. You can see this in the following (#' is a shorthand to get the var rather than the thing it contains). user=> (meta f1)

Re: Meta data access

2012-10-22 Thread Jim - FooBar();
Direct copy-paste from my repl: user=> (defn ^{:test true} f1 [] #_=> (println "call f1 fn")) #'user/f1 user=> user=> (defn ^{:test false} f2 [] #_=> (println "call f2 fn")) #'user/f2 user=> (:test (meta (var f1))) true user=> (:test (meta (var f2))) false user=> (println (:test (meta

Re: Meta data access

2012-10-22 Thread Mamun
Hi Jim Thank for your ans. But this does not work. When I run code I got "Unable to resolve var" error. Please find in bellow: CompilerException java.lang.RuntimeException: Unable to resolve var: form in this context, compiling:(NO_SOURCE_PATH:4) Source code- (defn ^{:test true} f1 [] (p

Re: Meta data access

2012-10-22 Thread Jim foo.bar
well not quite! you need (-> form var meta :test) or the same thing written differently (:test (meta (var form))) Hope that helps, Jim ps: basically the meta-data sit with the var not the function On 22/10/12 16:33, Jim fo

Re: Meta data access

2012-10-22 Thread Jim foo.bar
If I've understood correctly all you need is (meta form)... Jim On 22/10/12 15:30, Mamun wrote: Hi All, I've a application with following structure. Now I would like to access meta data of f1 and f2 within process function. (defn ^{:test true} f1 [] (println "call f1 fn")) (defn ^{:tes

Meta data access

2012-10-22 Thread Mamun
Hi All, I've a application with following structure. Now I would like to access meta data of f1 and f2 within process function. (defn ^{:test true} f1 [] (println "call f1 fn")) (defn ^{:test false} f2 [] (println "call f2 fn")) (def f* (list f1 f2)) (defn process [form] (do *