Inconsistency of dissoc on maps vs records?

2012-04-19 Thread Matthew Phillips
I've always liked the way assoc and dissoc return the original map instance when there's no change to be made. But this is not apparently true of records. e.g.: > (def m {:a 1}) > (identical? m (dissoc m :x)) ; true > (def r <>) > (identical? r (dissoc r :x)) ; false Does anyone know if there'

Re: Inconsistency of dissoc on maps vs records?

2012-04-19 Thread David Jagoe
On 20 April 2012 07:08, Matthew Phillips wrote: > I've always liked the way assoc and dissoc return the original map > instance when there's no change to be made. But this is not apparently > true of records. e.g.: Out of curiosity, why is this useful to you? I would imagine that the fact that

Re: Inconsistency of dissoc on maps vs records?

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 11:31 PM, David Jagoe wrote: > > Out of curiosity, why is this useful to you? > It certainly has performance benefits. When things are tested for equality (e.g., to test against keys in a hash map), identical things are the fastest to recognize as equal. Also, saves on

Re: Inconsistency of dissoc on maps vs records?

2012-04-20 Thread David Jagoe
On 20 April 2012 07:38, Mark Engelberg wrote: > On Thu, Apr 19, 2012 at 11:31 PM, David Jagoe wrote: > >> >> Out of curiosity, why is this useful to you? >> > > It certainly has performance benefits. > > When things are tested for equality (e.g., to test against keys in a hash > map), identical t

Re: Inconsistency of dissoc on maps vs records?

2012-04-20 Thread David Nolen
Calls to = call identity? first. On Fri, Apr 20, 2012 at 2:38 AM, Mark Engelberg wrote: > On Thu, Apr 19, 2012 at 11:31 PM, David Jagoe wrote: > >> >> Out of curiosity, why is this useful to you? >> > > It certainly has performance benefits. > > When things are tested for equality (e.g., to test

Re: Inconsistency of dissoc on maps vs records?

2012-04-21 Thread Matthew Phillips
On Friday, April 20, 2012 4:01:54 PM UTC+9:30, David Jagoe wrote: > > > On 20 April 2012 07:08, Matthew Phillips wrote: > >> I've always liked the way assoc and dissoc return the original map >> instance when there's no change to be made. But this is not apparently >> true of records. e.g.: > >