In Mathematica 12.2, I'd like to have a user-defined function create a data structure, initialize it, and return it. I'm failing at the 1st step, so instead creating it beforehand with the function performing the initialization:
getCommodityHash[hash_] :=
hash["Insert", #[[1]] -> #[[2]]] & /@ {{"somekey", "somevalue"}};
...
spamHash = CreateDataStructure["HashTable"];
getCommodityHash[spamHash];
I'd prefer to have this calling sequence though:
spamHash = getCommodityHash[];
How is this done?