-
Notifications
You must be signed in to change notification settings - Fork 69
union, unionBy are not symmetrical in their arguments #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It definitely seems weird, although we seem to have inherited it from Haskell where it is documented as preserving duplicates in the first list. I'd vote for 3 or 4. |
Ah, good point. The same thing applies for |
I can see how this behaviour makes sense for something like |
This seems weird:
I would have expected the result to be
[0, 1]
, but at least it should be symmetrical in both arguments. I would consider several possible fixes:union a b == nub (a <> b)
)union [0, 0] [1, 1] == [0, 0, 1, 1]
).union
andunionBy
fromData.Array
(given thatSet
is the better data structure for something like this)I would vote for 1 or 3.
The text was updated successfully, but these errors were encountered: