Re: [racket-users] How to implement a hash function for different types?

2019-08-02 Thread Jesse Wang
On Saturday, August 3, 2019 at 1:36:01 PM UTC+8, Jon Zeppieri wrote: > > On Sat, Aug 3, 2019 at 12:52 AM Jesse Wang > wrote: > > > > If I want to turn the hash code into array index in a hash table, do I > need to > > apply another uniform hash function such as

Re: [racket-users] How to implement a hash function for different types?

2019-08-02 Thread Jesse Wang
g N can be treated reasonably as a > > constant." See. https://docs.racket-lang.org/reference/hashtables.html > > > > Justin > > > > On Fri, Aug 2, 2019 at 9:22 PM Jesse Wang > wrote: > > > > > > Racket allows different types of keys in a single

[racket-users] Re: How to implement a hash function for different types?

2019-08-02 Thread Jesse Wang
On Saturday, August 3, 2019 at 9:22:16 AM UTC+8, Jesse Wang wrote: > > Racket allows different types of keys in a single hash, so there must be a > hash function that works for different types(different primitive types), I > wonder how Racket implements this under the hood. >

[racket-users] How to implement a hash function for different types?

2019-08-02 Thread Jesse Wang
Racket allows different types of keys in a single hash, so there must be a hash function that works for different types(different primitive types), I wonder how Racket implements this under the hood. Also, If I want to implement a hash table which allows different types of keys, how can I implem

Re: [racket-users] Why custom-display of printable<%> interface is called twice?

2019-07-28 Thread Jesse Wang
write to the port. > > (define/public (custom-display out) > (displayln "custom-display" out)) > (define/public (custom-write out) > (writeln "custom-write" out)) > > > On Sun, Jul 28, 2019 at 2:45 AM Jesse Wang > wrote: > >> H

[racket-users] Why custom-display of printable<%> interface is called twice?

2019-07-28 Thread Jesse Wang
Hi, I created a simple class to test the printable<%> interface: (define my-class% (class* object% (printable<%>) (super-new) (define/public (custom-display out) (displayln "custom-display")) (define/public (custom-write out) (writeln "custom-write")) (define/public (