[chuck-users] object / class hacking

Robert Poor rdpoor at gmail.com
Wed Sep 30 08:26:02 EDT 2009


Hans:

Of course I'd love to use a hashmap.  But how do you get one in  
Chuck?  AFIK, the existing chuckain "hash array" lacks a means to  
iterate over its contents.

- Rob

On 30 Sep 2009, at 02:03, Hans Aberg wrote:

> On 30 Sep 2009, at 02:13, Robert Poor wrote:
>
>> I guess the question should be: what's the fastest way to maintain  
>> a *set* of objects (i.e. a collection in which an object may only  
>> appear once) with the usual operations for insertion, deletion and  
>> iteration?
>
> For lookup tables, if you do not need to compare the keys, a hash  
> map is fastest - time complexity O(1), otherwise a balanced tree  
> (like C++ std::map) - complexity O(log n). There might be some C++  
> hash map classes at <http://www.boost.org/>. But if n is small and  
> use not too intense, just about any container will do.
>
>  Hans


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20090930/fb748000/attachment-0001.html>


More information about the chuck-users mailing list