There is meta data on var's which you need to use (meta (var sym)) to
get at, but I'm under the impression that the var metadata is mostly
for the benefit of the language runtime and a few core functions (like
doc).
The regular use of metadata I think is when you add it yourself to
symbols or collections (something implementing clojure.lang.IObj).
Then you can get at it by just using the meta function or the ^ reader
macro.

Examples:

user> (with-meta 'hello {'one 1})
hello
user> ^*1
{one 1}
user> #^{'two 2} ['world]
[world]
user> (meta *1)
{two 2}
user>

I'm pretty new to this whole interactive development and lisp thing
myself but I find it pretty easy to just experiment at the repl to
find out how things work, as well as reading other peoples code
(especially core.clj) for examples.
And you can always ask questions here on the list or on IRC, people
are pretty friendly :)

On Mar 2, 4:43 pm, David <david.ra...@gmail.com> wrote:
> On Mar 2, 3:04 pm, Michael Wood <esiot...@gmail.com> wrote:
>
> > I don't think David is having trouble finding the documentation for
> > meta.  He's complaining that the output of (doc meta) does not tell
> > you that you need to use (meta (var meta)) instead of (meta 'meta) or
> > (meta meta).
>
> Something like that, yes. Now, if the :doc in question contained "for
> example (meta (var something))" it would've been user friendlier. At
> least for newcomers like me who don't know that "obj" (in the
> meta :doc) really means "var".
>
> The more I think of it, the more I realize that :doc is not the best
> way of describing what it contains. I'd say it's more like :ref (as in
> reference). If you're a seasoned Clojure (OK Lisp) programmer, you
> quickly grasp onto the meaning, but if you're an old fashioned Java
> one, you might need more. So...
>
> Here's a proposal: break the existing :doc into :ref, :exmpl and :doc.
> Or even some sort of :xdoc containing an XML structured data
> (including real-world examples), which one could transform (using
> XSLT) into human-readable format (including colours, bold text, and
> other eye-catching rendering tricks) tailored also for IDE usage.
>
> Regards,
> David
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to