Re: defrecord and map equality?

2010-08-04 Thread Rich Hickey
On Jul 29, 11:51 pm, Ryan Twitchell metatheo...@gmail.com wrote: Hi all, I noticed (with a very recent git pull) the following asymmetric behavior regarding = and records: (defrecord my-record [a]) (def r (new my-record 1)) (def s (new my-record 1)) (= r s)        ;; true (= s r)    

Re: defrecord and map equality?

2010-07-30 Thread Frederick Polgardy
I'm sure it's not intentional, but it makes sense. In the first case, the comparison delegates to `r`'s equals() method, which would return false because {:a 1} isn't a `my-record`. In the second case, the comparison delegates to `{:a 1}`'s equals() method, which is a PersistentArrayMap, which

Re: defrecord and map equality?

2010-07-30 Thread Nicolas Oury
On Fri, Jul 30, 2010 at 4:51 AM, Ryan Twitchell metatheo...@gmail.com wrote: (= r s)        ;; true (= s r)        ;; true (= r {:a 1})   ;; false (= {:a 1} r)   ;; true Is this intentional? (I hope not) The three first are documented in (doc defrecord) In addition, defrecord will define

defrecord and map equality?

2010-07-29 Thread Ryan Twitchell
Hi all, I noticed (with a very recent git pull) the following asymmetric behavior regarding = and records: (defrecord my-record [a]) (def r (new my-record 1)) (def s (new my-record 1)) (= r s);; true (= s r);; true (= r {:a 1}) ;; false (= {:a 1} r) ;; true Is this