Re: Object identity and with-meta

2012-11-23 Thread Jonathan Fischer Friberg
When you compare functions, it only checks if it is the same function object (not if the function "behaves" the same way). For example: (= (fn []) (fn [])) ;=> false The reason you get false in your case is because with-meta returns a new object every time you call it. We need a new object to kee

Re: Object identity and with-meta

2012-11-23 Thread László Török
Hi, only for persistent data structures (with a few caveats) [1]. For other objects, such as function objects, equality check falls back to .equals(). Since with-meta returns a new object instance of an anonymous class, .equals will always be false. [1] https://github.com/clojure/clojure/blob/ma

Object identity and with-meta

2012-11-23 Thread N8Dawgrr
I have unexplained behavior for with-meta. As far as I understand with-meta should not alter object identity. E.g. if we have the (= a b) => true for some a and b then (= (with-meta a ma) (with-meta b mb)) => true should also hold for any ma and mb. So why do I get the following behavior at th