I have a feeling this probably has been discussed before, but please
refresh my memory in that case.
When | is used on arrays, all elements that occurs in both follows the
order in the second operand:
> ({1,2}) | ({2,1});
(1) Result: ({ /* 2 elements */
2,
1
})
This has surprised users on several occasions, and it's also at odds
with how & handles it:
> ({1,2}) & ({2,1});
(2) Result: ({ /* 2 elements */
1,
2
})
The old tutorial says that the order is taken from the left argument,
but afaics it has never been that way for |.
So I think the behavior in | is a bug and would like to fix it (maybe
with compat provisions). But I see there's a test in the testsuite
that appears to test this very consciously:
test_equal( ({1,2,3,4,4}) | ({3,5,6}), ({1,2,4,4,3,5,6}))
So before I go ahead and break something, I'd like to if there's a
thought behind it and what it is in that case.