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 []
(println "call f1 fn"))
(defn ^{:test false} f2 []
(println "call f2 fn"))
(def f* (list f1 f2))
(defn process [form]
(do
(form) ; it will call f1, f2...
;I need to access meta data of f1, f2......
* ;(println (:test (meta (var form)))) ;Error*
(println (str "-->" form))))
(map #(process %1) f*)
Regards,
Mamun
On Monday, October 22, 2012 5:45:21 PM UTC+2, Jim foo.bar wrote:
>
> 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 foo.bar wrote:
>
> 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 ^{:test false} f2 []
> (println "call f2 fn"))
>
> (def f* (list f1 f2))
>
> (defn process [form]
> (do
> * //Would like to access meta data of form*
> (println (str "-->" form))))
>
> (map #(process %1) f*)
>
> Does any one have any idea?
>
>
> Regards,
> Mamun
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected] <javascript:>
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> 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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en