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: Scheme style auto-resizing hashtable (fwd)


I updated the names according to Ian and Harvey's suggestions.

constructors:

        make-dictionary
        make-dictionaryv
        make-dictionaryq
	make-dictionaryx

reconstructor (in case any key-value pairs are knowingly altered so that
the new key no longer hashes to the same value):

	dictionary-rehash!       -- dictionary-rebuild!  ???

predicate (ver' important):

	dictionary?

behavior modifiers:

        dictionary-enable! 
        dictionary-disable!
        dictionary-change-type!

the big three basic operations:

        dictionary-insert!
        dictionary-lookup
        dictionary-remove!

iterators and friends:

        dictionary-map                <-> ???  "map-keys" "map-values" ???
        dictionary-foreach            <-> ???  "foreach-keys" ... ???
	dictionary-make-iterator  -- perhaps add an "auto-grow"
				  -- option to be toggled off until
				  -- iterator is finished
	call-with-dictionary-iterator

dictionary to whatever conversions:

	dictionary->alist    -- was dictionary->items, the pairs in
				the alist are the same objects as the
				pairs in the dictionary (they're eq?)
	dictionary->keys  
	dictionary->values

whatever to dictionary "conversions":

	dictionary-insert-alist!
	dictionary-consume-alist!  -- delete alist while
				   -- inserting pairs (to conserve memory)
	dictionary-insert-dictionary!
	dictionary-consume-dictionary! -- delete buckets while 
                                       -- inserting entries

statistics:
	
	dictionary-stats
	dictionary-more-stats

the rest:

        dictionary-clear!   -- delete all the buckets while removing
			       all entries.  easier on Guile's gc than
			       e.g. (set! my-dictionary 'foo)
			       also, the dictionary keeps all the options
			       set by the user

        dictionary-copy     -- just deep enough to make new cons cells for
                               the key-value pairs