[racket-dev] Optional equality predicate for assoc and member

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Apr 25 07:11:12 EDT 2011

10 hours ago, Robby Findler wrote:
> On Sun, Apr 24, 2011 at 8:06 PM, Eli Barzilay <eli at barzilay.org> wrote:
> >
> > I don't think that there would be a locality issue -- you never
> > dereference the slow pointer.
> I thought the way it worked was you had two pointers into the list
> and you did cdr on one and cddr on the other and checked if they
> were eq?.

Yeah, and I think that the cdr pointers usually don't have a problem
(since long lists tend to be allocated in a short time), vs the car
pointers that are probably more random.  But with a GC in the way
there's probably enough noise to make it not be a problem.

10 hours ago, Matthew Flatt wrote:
> Also, if a program uses `assoc' on a list that's long enough for
> locality of the turtle to matter, then it probably has bigger
> problems. [...]

Yeah, that sounds reasonable -- I'd expect the extra variable to be
the extra cost.

> I don't think the current cycle-checking cost is significant.

(I'll try that.)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.