=> (.equals (AA. 1) {:a 1} ) true => (= (AA. 1) {:a 1} ) false => (.equals {:a 1} (AA. 1) ) true => (= {:a 1} (AA. 1) ) false
Looks like "=" is not ".equals", hmm... but this doc says different: http://clojuredocs.org/clojure_core/clojure.core/= > Equality. Returns true if x equals y, false if not. Same as > Java x.equals(y) except it also works for nil, and compares > numbers and collections in a type-independent manner. Clojure's immutable > data > structures define equals() (and thus =) as a value, not an identity, > comparison. > On Sat, Oct 20, 2012 at 9:54 PM, Warren Lynn <wrn.l...@gmail.com> wrote: > With Clojure 1.4, I see this: > > (defrecord AA [a]) > (= (AA. 1) {:a 1}) => false > (= [1 2] '(1 2)) => true > > Another thread mentioned the second case. So if the second case is true, I > thought the first one should be true too (different concrete type, but same > data).I am quite confused. Is there any design guideline that can help me > understand the behavior above? Thanks. > > -- > 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 -- I may be wrong or incomplete. Please express any corrections / additions, they are encouraged and appreciated. At least one entity is bound to be transformed if you do ;) -- 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