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)


On Mon, 2 Nov 1998, Jay Glascoe wrote:

> okay, done!  But I'll keep "make-dictionary", "make-dictionaryv", and
> "make-dictionaryq" (just to spite you, Harvey   ;) 
> and I'll add:
> 
> primitive: make-dictionaryx [equality-predicate] [hasher-function]

nope, changed my mind.  I like this better:

primitive: make-dictionaryx equality-predicate hasher-function [alist]

	both "equality-predicate" and "hasher-function" are required.
	If you want, e.g. "equal?" and "hasher" then call
	"make-dictionary" instead.  "alist", if provided, must
	be a proper list of pairs.  Return a new "dictionaryx"
	with "alist"'s pairs as entries.

and I can have, e.g.

primitive: make-dictionary [alist]

The dictionary headers will look like this:

#(dictionary 0 #t #t)
#(dictionaryv 0 #t #t)
#(dictionaryq 0 #t #t)
#(dictionaryx 0 #t #t user-predicate user-hasher)

I like to keep the 'dictionaryX symbols up front for easy type-checking.

I figure that "dictionary", "dictionaryv", and "dictionaryq" type
dictionaries will be used much more often than the "dictionaryx" type.  So
rather than modifying (unifying) my 3 pre-existing constructors, I'm going
to make the "dictionaryx" type the red-headed bastard-child of the lot  ;)

> One caveat: both arguments must be symbols bound to procedures or
> primitives available to the current scope.

hopefully they're top-level definitions.  You showed me how to display
procedures for "read"/"write", but I think I'd rather stick with the
symbols. 

	Jay Glascoe
	jglascoe@jay.giss.nasa.gov