[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Tables
I would like to see some discussion about desirable features for
the T table package.
Recall that the current ("Released", although it isn't in the manual)
table package supports the following operations:
(MAKE-TABLE tag) => table
(TABLE-ENTRY table key) => value or nil if none
(settable)
(SET-TABLE-ENTRY table key value) => undefined
(adds an association)
Now, the wish list.
Clearly, it is desirable to have hash tables where the hash function
and comparision function are other than POINTER-HASH (or some other
hack) and EQ?. Obvious examples are <STRING-HASH, STRING-EQUAL?>,
<SYMBOL-HASH, EQ?>, and <TREE-HASH, ALIKEV?>.
Weak Tables. A table is a list of associations - pairs of
keys and values. If the key is garbage, i.e., is no longer accessible,
I would like the association (i.e. the pointer to the value) to go away.
This is not implementable in the current scheme.
Table Walking. It is desirable (occasionally) to apply a procedure to
each <key,value> pair in a table. This is possible in the current
scheme only if you put a layer on top of the table package.
Generators. I often write the following idiom:
(or (table-entry table key)
(set (table-entry table key) (make-value key)))
This would be eliminated by the provision of a generator procedure
to be called in the case when there is no value associated
with the key in a call to TABLE-ENTRY.
Before someone goes out and blindly writes a new table package,
I'd like to hear more feedback. Are these idioms you use a lot?
Are there other ideas you really need? Is this even the proper
abstraction?
--- Jonathan
-------