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)


Just some comments on naming:

...
> 	dictionary-lookup

Should this maybe be dictionary-ref -- to keep with the vector-ref
notation?  Not that "ref" is too meaningful, but it is consistent.
Well, maybe... lookup sounds better, but remembering which
good-sounding accessor goes with which data type can be hard.

...
> 	dictionary-map
> 	dictionary-foreach

dictionary-map-pair, dictionary-foreach-pair.  Or
dictionary-map-value, dictionary-foreach-value.  I'd vote for mapping
to values as being the default (i.e., dictionary-map maps the values).

And, as I think about it, dictionary-map-pair is unlikely to be used,
a rather silly function, I think.  dictionary-foreach-pair is all you
probably need.

("pair" or "association"?  Pair is shorter, association is more
accurate...)


A dictionary-rehash! function, perhaps?

If dictionary-update! does what I think, it should probably be called
dictionary-set!

There should be a "dictionary?"

It might be nice to have a form like:
(dictionary '((key1 . value1) (key2 . value2) ...))

Or maybe:
(dictionary '(key1 . value1) '(key2 . value2) ...)
I don't know which is really better.

dictionary-stats and dictionary-more-stats don't make any sense to me.
If there are a lot of stats, maybe a lot of functions are called for
(one for each stat).  If collecting the stats is expensive, but you
get them all at once, then... hmm... I dunno.

Why is there a "!" after dictionary-copy! ?  Doesn't it make a
(non-destructive) copy of a dictionary?

Maybe there should be a dictionary-append! (is this what you meant by
dictionary-copy!?)  "append" does imply some sort of ordering, though.

What is dictionary-clear! supposed to do?

There should be a dictionary-length.

That's all I can think of at the moment.


<------------------------------------------------------------------->
< Ian Bicking                 |  bickiia@earlham.edu                >
< drawer #419 Earlham College |  http://www.cs.earlham.edu/~bickiia >
< Richmond, IN 47374          |  (765) 973-2824                     >
<------------------------------------------------------------------->