Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 Bib Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

8 Hashsets
 8.1 API

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( [values][,] [hashfunc[, eqfunc]][,] [capacity] )( function )

Create a new hashset. The optional argument values must be a list of values, which will be inserted into the new hashset in order. 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.

8.1-3 AddSet
‣ AddSet( hashset, obj )( operation )

Add obj to hashset.

8.1-4 \in
‣ \in( obj, hashset )( operation )

Test membership of obj in hashset

8.1-5 RemoveSet
‣ RemoveSet( hashset, obj )( operation )

Remove obj from hashset.

8.1-6 Size
‣ Size( hashset )( operation )

Return the size of a hashset Returns an integer

8.1-7 IsEmpty
‣ IsEmpty( hashset )( operation )

Returns: a boolean

Test a hashset for emptiness.

8.1-8 Set
‣ Set( hashset )( operation )

Returns: a set

Convert a hashset into a GAP set

8.1-9 AsSet
‣ AsSet( hashset )( operation )

Returns: an immutable set

Convert a hashset into a GAP set

8.1-10 Iterator
‣ Iterator( set )( operation )

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.

 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 Bib Ind

generated by GAPDoc2HTML