HashTableInterface
BeginPackage["HashTableInterface`"];
HashTable::usage="Interface wrapper to a HashTable";HashTableQ::usage="Tests whether object is proper HashTable";
BeginPackage["`Package`"];
HashTableAdd::usage="";HashTableClone::usage="";HashTableContainsQ::usage="";HashTableGet::usage="";HashTableKeys::usage="";HashTableMapAt::usage="";HashTableRemove::usage="";HashTableSet::usage="";HashTableToAssociation::usage="";HashTableValues::usage="";
HashTableFromAssociation::usage= "Creates a HashTable from an Association";HashTableKeyCopy::usage= "Copies values from one HashTable to another by key";
HashTableLookup::usage= "Implementation of Lookup for HashTable objects";
HashTableKeyValueMap::usage= "Implementation of AssociateTo for HashTable objects";HashTableAssociateTo::usage= "Implementation of AssociateTo for HashTable objects";HashTableKeyDropFrom::usage= "Implementation of KeyDropFrom for HashTable objects";HashTableKeySelect::usage= "Implementation of KeySelect for HashTable objects";HashTableKeyDrop::usage= "Implementation of KeyDrop for HashTable objects";HashTableKeyTake::usage= "Implementation of KeyTake for HashTable objects";
HashTableSelect::usage= "Implementation of Select for HashTable objects";HashTableMapMap::usage= "Implementation of Map for HashTable objects";HashTableJoin::usage= "Implementation of Join for HashTable objects";
HashTableMap::usage= "Implementation of AssociationMap for HashTable objects";HashTableThread::usage= "Implementation of AssociationThread for HashTable objects";
HashTableMMap::usage= "Mutating Map for HashTable objects";HashTableMJoin::usage= "Mutating Join for HashTable objects";
EndPackage[];
Begin["`Private`"];
HashTable//Clear;
⌈Constructor⌋
⌈Format⌋
⌈Package Functions⌋
⌈Add⌋
⌈Clone⌋
⌈ContainsQ⌋
⌈Get⌋
⌈Lookup⌋
⌈Keys⌋
⌈MapAt⌋
HashTableMapAt[f_,h:HashTable[ht_System`Utilities`HashTable],s_]:= Scan System`Utilities`HashTableMapAt[ht,#,f]&, Flatten@{s}
⌈Remove⌋
⌈Set⌋
⌈ToAssociation⌋
⌈Values⌋
⌈KeyValueMap⌋
⌈AssociateTo⌋
⌈KeyDropFrom⌋
⌈KeyCopy⌋
⌈FromAssociation⌋
⌈KeySelect⌋
⌈KeyTake⌋
⌈KeyDrop⌋
⌈KeyIntersection⌋
⌈KeyComplement⌋
⌈Thread⌋
⌈Map⌋
⌈MapMap⌋
⌈Select⌋
⌈Join⌋
⌈MMap⌋
⌈MJoin⌋
⌈DownValues⌋
⌈Clone⌋
⌈MapAt⌋
⌈MMap⌋
⌈MJoin⌋
⌈Get⌋
⌈UpValues⌋
⌈Mutation⌋
End[];
EndPackage[];
In[]:=
<<HashTableInterface`
Get["https://github.com/b3m2a1/mathematica-tools/raw/master/HashTableInterface.m"]
In[]:=
ht=HashTable@{12,34}
Out[]=
HashTable
In[]:=
Keys@ht
Out[]=
{3,1}
In[]:=
Normal@ht
Out[]=
34,12
In[]:=
AssociationMap[Reverse,ht]//Normal
Out[]=
43,21
In[]:=
ht@"Map"[#+1&]
In[]:=
ht//Normal
Out[]=
35,13
In[]:=
ht["sampleKey"]=RandomReal[]
Out[]=
0.751594