fns are normal values, I guess you got strange glitch, try with the fresh 
vm/repl:

(def fff ^{:a 1} (fn [] 4))
#<[object Object]>
=> nil

(meta fff)
=> {:a 1}

(meta ^{:a 1} (fn [] 4))
=> {:a 1}

четверг, 28 мая 2015 г., 10:49:53 UTC+3 пользователь Mike Thompson написал:
> On Thursday, May 28, 2015 at 5:39:54 PM UTC+10, Ruslan Prokopchuk wrote:
> 
> 
> Okay, thanks, that makes some sense.  So, attaching metadata to the var 
> rather than the value the var is bound to.  Got it.
> 
> But ... I then performed this experiment where I feel I am attaching metadata 
> to the value ...
> 
> (def fff ^{:a 1} (fn [] 4))
> 
> (meta fff)  ;; => nil
> 
> Damn.
> 
> And here's what's odd:
> 
> (def v  ^{:b 1} [1 2 3])
> 
> (meta v)  ;; =>  {:b 1 .....}
> 
> So, when it comes to metadata, this:
>      ^{:a 1} (fn [] 4)
> 
> is different to:
>      ^{:b 1} [1 2 3]
> 
> 
> So fns are not normal values? Something else?
> 
> I'll get this eventually.
> 
> --
> Mike
> 
> 
> 
> 
> 
> > `with-meta` is the thing which deals with value, you get "an object of the 
> > same type and value as obj, with map m as its metadata". But `defn`, which 
> > is essentially `(def ... (fn ...` creates a Var, and attaches metadata to 
> > that Var, not its value.
> > 
> > четверг, 28 мая 2015 г., 10:30:14 UTC+3 пользователь Mike Thompson написал:
> > > On Thursday, May 28, 2015 at 4:55:09 PM UTC+10, Ruslan Prokopchuk wrote:
> > > > (meta #'f)
> > > 
> > > 
> > > Hmm.  I think there's something fundamental I'm not grasping here. But 
> > > I'm struggling to ask the right question to get the ahhh moment.
> > > 
> > > Perhaps this:  why, in my original example code, does (meta f) return 
> > > nil,  but (meta ff) return {:b 1}.   What is different about the 
> > > attachment of metadata?
> > > 
> > > --
> > > Mike

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to