[chuck-users] implementing a set (was object / class hacking)

Hans Aberg haberg at math.su.se
Wed Sep 30 17:54:27 EDT 2009

On 30 Sep 2009, at 23:28, Robert Poor wrote:

> I've written several flavors of hash tables in my life, but I'm not  
> sure how the Stroustrup code sample helps in this case.  If you are  
> suggesting that I hack the Chuck source code, you should know that I  
> do entertain such ideas from time to time, but I usually come back  
> to my senses within 25::samp -- it's just not on my list of  
> priorities.
> A "written entirely in ChucK" solution -- albeit non-optimal in  
> execution speed -- is good enough for my needs.  I'm more into  
> optimizing my days than my milliseconds.

You might combine it with the earlier idea:
   class ObjectKey {
     Object object_;
     int key_;
If using strings as key, you would need to extract the characters. So  
perhaps use a global int incremented for each instantiation. Then hash  
with %.


More information about the chuck-users mailing list