next | previous | forward | backward | up | top | index | toc | home
Macaulay2 > The Macaulay2 language > hash tables > HashTable

HashTable -- the class of all hash tables

Description

A hash table consists of: a class type, a parent type, and a set of key-value pairs. The keys and values can be anything. The access functions below accept a key and return the corresponding value. For details of the mechanism underlying this, see hashing.

One important feature of hash tables that when the keys are consecutive integers starting at 0, the keys are scanned in the natural order.

There is a subclass of HashTable called MutableHashTable which consists of those hash tables whose entries can be changed.

Access functions:

  • # -- length, or access to elements
  • . -- access to elements whose key is a symbol
Query functions:
  • #? -- check for presence of elements
  • .? -- check for presence of elements whose key is a symbol

Types of hash table :

Functions and methods returning a hash table :

Methods that use a hash table :

Fixed objects of class HashTable :

For the programmer

The object HashTable is a type, with ancestor class Thing.