Guile Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scheme style auto-resizing hashtable (fwd)
> > My table-remove! and index-remove! have optional arguments, if you
> > only supply one argument (the table) they delete everything, as you
> > supply more args they get more selective. I'm still wondering if this
> > use for optional arguments is clever or just confusing.
>
> sounds a bit dangerous, consider
>
> (apply dictionary-clear! lst)
>
> the user means for "lst" to be (my-dictionary #t) or whatever, but
> mistakenly has it set to just (my-dictionary)
Hmmm, I see justice in this argument, so blah-remove! should take out
just a single item and blah-clear! should take out all items.
> here's a new list of dictionary procedures
>
> constructors:
>
> make-dictionary
> make-dictionaryv
> make-dictionaryq
>
> 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 <-> ???
> dictionary-foreach <-> ???
> 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
> 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!
> dictionary-copy!
These all look pretty good to me.
Just a very fanciful suggestion: Is it possible to combine
``dictionary-insert-alist!'' and ``dictionary-insert-dictionary!''
into ``dictionary-insert!'' such that (dictionary-inset! D fred)
will look at the type of fred and modify it's behaviour accordingly?
Am I getting carried away here? Is someone likely to want a dictionary
of dictionaries?
I like the idea of the consumers, it should be a big saving on garbage
generation.
- Tel
Guile Home |
Main Index |
Thread Index