to get the meta-data of a var (I'm guessing symbol n refers to a var...)
you should call it on the var iself, not its value or symbol:
user=> (def ^{:some-meta 123} n 0)
#'user/n
user=> (meta n)
nil
user=> (meta 'n)
nil
user=> (meta #'n)
{:some-meta 123, :ns #<Namespace user>, :name n, :file "NO_SOURCE_PATH",
:column 1, :line 1}
hth,
-Gianluca
On Thursday, June 25, 2015 at 4:00:59 PM UTC+2, Sarkis Karayan wrote:
>
>
> Why doesn't this work?
> user=> (meta ^{:some-meta 123} 'n)
> nil
>
> While this works:
> user=> (meta ^{:some-meta 123} (fn [n] n))
> {:some-meta 123}
>
> And this works too:
> user=> (meta (with-meta 'n {:some-meta 123}))
> {:some-meta 123}
>
>
> Is this intended behavior? If so, what's the reasoning?
>
> Thanks,
> Sarkis
>
>
--
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.