The PCE class hash_table implements a fast associative table. Hash-tables are commonly used to map symbols on values. For example, PCE itself uses the hash_table @classes to map class names onto class objects.
PCE hash_tables are implemented as closed hash_tables.
The number of
buckets in enlarged automatically as the number of symbols
in the table grows.
Note that hash_tables implement the standard set operations hash_table->for_all,
hash_table->for_some, hash_table<-find_key
and hash_table<-find_value.
See also class chain_table (mapping a key onto multiple values), class sheet and class table (multi-column indexed table).
NOTE: The number of buckets is a power of 2. Hash-table literature claims prime numbers to provide a better distribution. Timing on the SUN-SPARC station suggests this does ot compensate for the difference between a division and a masking operation.
key;
the second is the associated value. If the key was already in the table,
associated value is changed.
->buckets
method may be used to make the table smaller.
The next legal value (large enough and a power of 2) is used.
->clear, hash_table<-size
equals 0. The number of buckets is not changed.->delete
fails.<-size
equals 0.
@arg1: Key of the symbol @arg2: Value of the symbol
Note that the order in which the symbols are presented to the code is not specified.
@arg1: Key of the symbol @arg2: Value of the symbol
Note that the order in which the symbols are presented to the code is not specified.
Defaults: 8
@arg1: Key of the symbol @arg2: Value of the symbol
Fails if there is no symbol for which code succeeds. Note that the
order in which the symbols are presented to the keys is not specified.
See also hash_table<-find_value.
@arg1: Key of the symbol @arg2: Value of the symbol
Fails if there is no symbol for which code succeeds. Note that the order in which the symbols are presented to the keys is not specified.