makeHashTable (HashTable)
makeHashTable ( range -- table )
Creates a table from a range of pairs (key value), aliasing all entries.
makeHashTable ( list -- table )
Creates a table from a builtin-list of pairs (key value), aliasing all entries.
Arguments
makeHashTable ( range -- table )
range
of (key value) pairs (see Range).
makeHashTable ( list -- table )
list
is a builtin-list (key value) pairs.
Return values
table
is the resulting HashTable.
Complexity
O(size)
Example
"sl/hashTable" useFile
l1: ((1 "ONE") (2 "TWO") (3 "THREE")) makeHashTable;
l2: l1.makeRange makeHashTable copy;
l1 [print "," print TRUE] enum LF print
l2 [print "," print TRUE] enum
Output:
{ key: 1; value: "ONE"; },{ key: 2; value: "TWO"; },{ key: 3; value: "THREE"; }
{ key: 1; value: "ONE"; },{ key: 2; value: "TWO"; },{ key: 3; value: "THREE"; }