The repository has not been cloned yet. Run the following command first
to clone the repo, check out the target commit, and install dependencies:
bash
bash /setup_files/setup.sh
The code will then be available at /testbed.
You are working on the repository DALPy-Developers/DALPy (instance: DALPy-Developers__DALPy-16).
The code is located in /testbed.
##15 Changes to HashTable and Set
Is your feature request related to a problem? Please describe.
Currently there is no way to iterate over the keys of a HashTable.
Also, I believe that Set should operate more like a mathematical set versus a Java/Python set. That is, modification to the Set should be done via difference and union operations with other Sets.
Describe the solution you'd like
One should be able to get either get the keys (have HashTable have a function that returns a collection of them) or be able to iterate over the keys (e.g. for k in t).
In regard to Set, add() should be removed and replace with union() which takes a Set. That way, Set will operate more how you would use it in pseudocode:
text
S = S U {1}
T = T - {2}
S = S U T
Describe alternatives you've considered
To iterate over a HashTable now, the keys must be stored in an external data structure like an Array or Set. I also think it is best that iteration is kept to over keys to avoid confusion with tuples (like the behavior of Python dict's items()).
For Sets the alternative is to keep add() (and possible inclue a remove()) but those operate on single elements. Since singleton Sets can be easily created, I think it is suitable to use union and difference operations in their place.