User Tools

A PCRE internal error occured. This might be caused by a faulty plugin

====== Function MAKE-HASH-TABLE ====== ====Syntax==== * **make-hash-table** //''&key'' test size rehash-size rehash-threshold// → //hash-table// ====Arguments and Values==== * //test// - a //[[CL:Glossary:designator]]// for one of the //[[CL:Glossary:functions]]// **[[CL:Functions:eq]]**, **[[CL:Functions:eql]]**, **[[CL:Functions:equal]]**, or **[[CL:Functions:equalp]]**. The default is **[[CL:Functions:eql]]**. * //size// - a non-negative //[[CL:Glossary:integer]]//. The default is //[[CL:Glossary:implementation-dependent]]//. * //rehash-size// - a //[[CL:Glossary:real]]// of //[[CL:Glossary:type]]// ''(or (integer 1 *) (float (1.0) *))''. The default is //[[CL:Glossary:implementation-dependent]]//. * //rehash-threshold// - a //[[CL:Glossary:real]]// of //[[CL:Glossary:type]]// ''(real 0 1)''. The default is //[[CL:Glossary:implementation-dependent]]//. * //hash-table// - a //[[CL:Glossary:hash table]]//. ====Description==== Creates and returns a new //[[CL:Glossary:hash table]]//. //test// determines how //[[CL:Glossary:keys]]// are compared. An //[[CL:Glossary:object]]// is said to be present in the //hash-table// if that //[[CL:Glossary:object]]// is the //[[CL:Glossary:same]]// under the //[[CL:Glossary:test]]// as the //[[CL:Glossary:key]]// for some entry in the //hash-table//. //size// is a hint to the //[[CL:Glossary:implementation]]// about how much initial space to allocate in the //hash-table//. This information, taken together with the //rehash-threshold//, controls the approximate number of entries which it should be possible to insert before the table has to grow. The actual size might be rounded up from //size// to the next `good' size; for example, some //[[CL:Glossary:implementations]]// might round to the next prime number. //rehash-size// specifies a minimum amount to increase the size of the //hash-table// when it becomes full enough to require rehashing; see //rehash-theshold// below. If //rehash-size// is an //[[CL:Glossary:integer]]//, the expected growth rate for the table is additive and the //[[CL:Glossary:integer]]// is the number of entries to add; if it is a //[[CL:Glossary:float]]//, the expected growth rate for the table is multiplicative and the //[[CL:Glossary:float]]// is the ratio of the new size to the old size. As with //size//, the actual size of the increase might be rounded up. //rehash-threshold// specifies how full the //hash-table// can get before it must grow. It specifies the maximum desired hash-table occupancy level. The //[[CL:Glossary:value|values]]// of //rehash-size// and //rehash-threshold// do not constrain the //[[CL:Glossary:implementation]]// to use any particular method for computing when and by how much the size of //hash-table// should be enlarged. Such decisions are //[[CL:Glossary:implementation-dependent]]//, and these //[[CL:Glossary:value|values]]// only hints from the //[[CL:Glossary:programmer]]// to the //[[CL:Glossary:implementation]]//, and the //[[CL:Glossary:implementation]]// is permitted to ignore them. ====Examples==== <blockquote> ([[CL:Macros:defparameter]] *table* (make-hash-table)) <r>*TABLE*</r> *table* <r>#<HASH-TABLE [[CL:Functions:EQL]] 0/120 46142754></r> ([[CL:Macros:setf]] ([[CL:Functions:gethash]] "one" *table*) 1) <r>1</r> ([[CL:Functions:gethash]] "one" *table*) <r>[[CL:Constant Variables:nil|NIL]], //[[CL:Glossary:false]]//</r> ([[CL:Macros:setf]] *table* (make-hash-table :test '[[CL:Functions:equal]])) <r>#<HASH-TABLE [[CL:Functions:EQUAL]] 0/139 46145547></r> ([[CL:Macros:setf]] ([[CL:Functions:gethash]] "one" *table*) 1) <r>1</r> ([[CL:Functions:gethash]] "one" *table*) <r>1, [[CL:Constant Variables:t|T]]</r> (make-hash-table :rehash-size 1.5 :rehash-threshold 0.7) <r>#<HASH-TABLE [[CL:Functions:EQL]] 0/120 46156620></r> </blockquote> ====Affected By==== None. ====Exceptional Situations==== None. ====See Also==== * **[[CL:Functions:gethash|Function GETHASH]]** * **[[CL:Types:hash-table|System Class HASH-TABLE]]** ====Notes==== None. \issue{HASH-TABLE-TESTS:ADD-EQUALP} \issue{ARGUMENTS-UNDERSPECIFIED:SPECIFY} \issue{HASH-TABLE-SIZE:INTENDED-ENTRIES} \issue{HASH-TABLE-SIZE:INTENDED-ENTRIES} \issue{HASH-TABLE-REHASH-SIZE-INTEGER} \issue{HASH-TABLE-SIZE:INTENDED-ENTRIES} \issue{HASH-TABLE-REHASH-SIZE-INTEGER} \issue{HASH-TABLE-SIZE:INTENDED-ENTRIES}