[racket] Implementing an equal? method for a class

From: Gregory Woodhouse (gregwoodhouse at me.com)
Date: Tue Jul 31 15:20:50 EDT 2012

Thanks to both of you. I'll change it to a single vector.


On Jul 29, 2012, at 3: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. 
> 
> 
> 
> 
> On Jul 29, 2012, at 6:00 PM, Eli Barzilay wrote:
> 
>> Yesterday, Gregory Woodhouse wrote:
>>>   (define b(make-vector 9 (make-vector 9 0)))
>> 
>> BTW, this is wrong -- it builds a vector of 9 zeros, then uses that
>> same vector 9 times:
>> 
>> -> (define x (make-vector 2 (make-vector 2 0)))
>> -> x
>> '#(#(0 0) #(0 0))
>> -> (vector-set! (vector-ref x 0) 0 1)
>> -> x
>> '#(#(1 0) #(1 0))
>> -> (print-graph #t)
>> -> x
>> '#(#0=#(1 0) #0#)
>> 
>> -- 
>>         ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>>                   http://barzilay.org/                   Maze is Life!
>> ____________________
>> Racket Users list:
>> http://lists.racket-lang.org/users
> 


Posted on the users mailing list.