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.


Harvey-

Tis true that guile's handling of hash tables is not the best,
especially in the resize / mapping department.  Some people on this
list recommend using slib's hash tables, but I generally use what
is available natively in guile:

   hashq-ref
   hashq-set!
   hashv-ref
   hashv-set!
   hash-ref!
   hash-set!

When I need to iterate over the hash table, I just use a do loop.

I would love to have a module that implements your suggestions,
though.  A user could bring in the module, and it would transparently
redefine the above functions, but it would also provide mapping
functions and automatic resize.

The next time I need to iterate over a hash table, I won't write the
requisite do loop, and instead I'll write this module.

-russ

--
"C makes it easy to shoot yourself in the foot.  C++ makes it
 harder, but when you do, it blows away your whole leg."
             -- Bjarne Stroustrup on C++