Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 Bib Ind

### 8 Hashsets

A hash set stores objects and allows efficient lookup whether an object is already a member of the set.

datastructures currently provides a reference implementation of hashsets using a hashtable stored in a plain GAP list.

#### 8.1 API

##### 8.1-1 IsHashSet
 ‣ IsHashSet( arg ) ( filter )

Returns: true or false

Category of hashsets

##### 8.1-2 HashSet
 ‣ HashSet( [hashfunc[, eqfunc, ]][capacity] ) ( function )

Create a new hashset. The optional argument hashfunc must be a hash- function, eqfunc must be a binary equality testing function that returns true if the two arguments are considered equal, and false if they are not. Refer to Chapter 6 about the requirements for hashfunctions and equality testers. The optional argument capacity determines the initial size of the hashmap.

 ‣ AddSet( hashset, obj ) ( function )

Add obj to hashset.

##### 8.1-4 \in
 ‣ \in( obj, hashset ) ( function )

Test membership of obj in hashset

##### 8.1-5 RemoveSet
 ‣ RemoveSet( hashset, obj ) ( function )

Remove obj from hashset.

##### 8.1-6 Size
 ‣ Size( hashset ) ( function )

Return the size of a hashset Returns an integer

##### 8.1-7 IsEmpty
 ‣ IsEmpty( hashset ) ( function )

Returns: a boolean

Test a hashset for emptiness.

##### 8.1-8 Set
 ‣ Set( hashset ) ( function )

Returns: a set

Convert a hashset into a GAP set

##### 8.1-9 AsSet
 ‣ AsSet( hashset ) ( function )

Returns: an immutable set

Convert a hashset into a GAP set

##### 8.1-10 Iterator
 ‣ Iterator( set ) ( function )

Returns: an iterator

Create an iterator for the values contained in a hashset. Note that elements added to the hashset after the creation of an iterator are not guaranteed to be returned by that iterator.

Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 Bib Ind

generated by GAPDoc2HTML