This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Hashtables in guile.


> > I have C++ source somewhere if anyone is interested.
> 
> Interested -- if it's not too much trouble for you.

http://www.progsoc.uts.edu.au/~telford/samples/hash/

The main idea of my implementation is to use void * to reference
all data and allow an arbitrary comparison function to be used.
The hash table is just an array with no chaining so you HAVE to
do a resize when the space is used up. If two objects get the same
hash value then it just rolls around the array looking for the next
free slot. This makes the code more complicated but the storage is
simpler and you don't have to worry about linked lists or mallocing
of containers (completely different to current guile hash tables).

Now that I look at the code, it isn't well commented (though there
are probably more than most of the libguile code) and it does utilise
lots of C++isms (back when I thought they were the greatest thing
and couldn't get enough of them).

	- Tel