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/master/src/jvm/clojure/lang/Util.java#L23 Hope it helps, Las 2012/11/23 N8Dawgrr <nathan.r.matth...@gmail.com> > 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 the REPL? > > user> (def f (partial * 2)) > > user> (= f f) > true > > user> (= (with-meta f {:a 1}) (with-meta f {:a 1})) > false > > Any help appreciated. > > -- > 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 > Note that posts from new members are moderated - please be patient with > your first post. > 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 -- László Török -- 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 Note that posts from new members are moderated - please be patient with your first post. 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