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


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


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)


Create a new empty HashSet.


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


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.