Set::newHashSet(3) Create a new empty HashSet.

SYNOPSIS

HashSet<a> newHashSet( Int buckets=157, Int(a) hashfn=hash )

ARGUMENTS

buckets The number of hashing buckets to use. A larger number of buckets increases the speed of the dictionary (up to a limit) but uses more memory. A good choice is the nearest prime number to 1.5*(expected number of entries) , with the default being 157.

hashfn The hashing function to use. This function must take a key, and return an integer. A good hashing function will return different values for similar keys (but must of course always return the same value for the same key!). A default built-in hashing function is provided, though if the keys are of type String , the Builtins.strHash(3kaya) function should be used instead, and if the keys are of type Int you may use Builtins.identity(3kaya) (though an array may provide faster insertion and lookup if the keys are positive and either small or largely sequential). If the keys are an especially complex data type, it may again be best to write your own hashing function. This argument may be omitted and defaults to Builtins.hash(3kaya)

DESCRIPTION

Create a new empty HashSet.

AUTHORS

Kaya standard library by Edwin Brady, Chris Morris and others ([email protected]). For further information see http://kayalang.org/

LICENSE

The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.

RELATED

Set.HashSet(3kaya)

Set.add(3kaya)

Set.array(3kaya)

Set.delete(3kaya)

Set.elem(3kaya)

Set.empty(3kaya)