Metadata is perhaps most frequently used on vars:
user=> (meta #'comp)
{:arglists ([] [f] [f g] [f g & fs]),
:doc
"Takes a set of functions and returns a fn that is the composition\n of
those fns. The returned fn takes a variable number of args,\n applies the
rightmost of fns to the args, the next\n fn (right-to-left) to the result,
etc.",
:added "1.0",
:static true,
:line 2426,
:column 1,
:file "clojure/core.clj",
:name comp,
:ns #object[clojure.lang.Namespace 0x6cc8adff "clojure.core"]}
And for providing type hints to the compiler:
(.endsWith ^String s ".txt")
I've also made use of metadata in Ring to tell the session middleware to
recreate the session with a new key:
(defn handler [request]
{:status 200
:headers {"Content-Type" "text/plain"}
:session ^:recreate {:foo "bar"}
:body "baz"})
And I've used metadata in Ittyon to denote whether a state transition is
reproducible (i.e. generated by a pure function).
- James
On 5 August 2015 at 13:01, Eric Le Goff <[email protected]> wrote:
> The page http://clojure.org/metadata states that it "can also be used by
> application developers for many purposes, annotating data sources, policy
> etc."
>
> Could anyone elaborate about some real use case scenarios where they need
> to use this metadata feature ?
>
> Regards,
>
>
> --
> Eric Le Goff
> http://fr.linkedin.com/in/elegoff
> @elegoff <https://twitter.com/elegoff>
>
> --
> 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
> ---
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.