Closed muawijhe closed 4 years ago
I wouldn't recommend using Pair in Set or Map because it is not Hashable or immutable. I do hope to support immutable tuple types that can be used as keys in Map and Set in v2 - no intention to implement that in 1.x though.
Hi! First of all, congrats for such a nice piece of software :)
Version tested in this issue: 1.1.8-1 (Ubuntu 18.04 amd64).
I'm trying to use the Set class as container of Pair. Union operation works flawlessly. However, diff function yields to unusual results. Example:
with these support functions, lets us try to run two tests:
now running the same test using Pair...
someone could give me a solid explanation of such result?
In particular,
in both cases, the equality operator == return correct results ( X == Y ).
in hash array case: A contains X, and because X==Y, A contains Y
in Pair case: A contains X, but A does not contain Y (but their values are equal! is the library checking the object pointer under the hood?)
The operation we would like to perform:
F = A + B -C = {X} + {Z} - {Y}
under the condition (X == Y), F = {Z}
Thanks in advance for your help