[racket] Implementing an equal? method for a class

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Jul 29 19:48:47 EDT 2012

Hey, when you're old enough to have programmed with Fortran IV, you have heard a lot of things. There's an even name I picked up at Rice, but I can't recall. 

Thanks for adding these things to the math library. 


On Jul 29, 2012, at 7:31 PM, Neil Toronto wrote:

> On 07/29/2012 04:19 PM, Danny Yoo wrote:
>> On Sun, Jul 29, 2012 at 6:07 PM, Matthias Felleisen
>> <matthias at ccs.neu.edu> wrote:
>>> 
>>> For 81 slots, I'd actually use a (define b (make-vector 81 0)) instead and use an access polynomial. I am almost certain that it is faster.
> 
> Probably so. It allocates less and has better cache behavior when accessing elements in row-major order.
> 
>> I'm unfamiliar with the term 'access polynomial'.  Would it be
>> accurate to say that it's a function f:
>> 
>>    f: (number number -> number)
>> 
>> such as
>> 
>>     (define COLUMN-LENGTH 9)
>>     (define (f row col) (+ (* row COLUMN-LENGTH) col))
>> 
>> allows us to treat the flat vector as if it were a two-dimensional
>> structure, by translating (row,col) into offsets?
> 
> That's it. I've never heard it called an "access polynomial" before, though that's exactly what it is.
> 
> When I merge the `math' collection for 5.4, such decisions will mostly be moot. It has an Array type, which does that for you in any number of dimensions.
> 
> Neil ⊥
> 
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users



Posted on the users mailing list.