hi,
when i combine two arrays using exclusive or (^) the order of the resulting elements appears to be like (a+b)-(elements from both):
a = ({ 1, 7, 2, 8, 4 }); b = ({ 2, 1, 3, 0, 5 }); a^b is ({ 7, 8, 4, 3, 0, 5 })
however if there are doubles a = ({ 1, 7, 2, 5, 4 }); b = ({ 2, 1, 3, 5, 5 }); a^b is ({ 7, 4, 3, 5 }) b^a is ({ 3, 5, 7, 4 })
one of them remains. what's the strategy here?
it looks like from both arrays it removes always the same number of elements.
greetings, martin.
Your examples doesn't show it, but elements are removed from the beginning towards the end in both arrays. Then the results are concatenated. E.g. ({1})^({1,2,1}) produces ({2,1}), not ({1,2}).
/ Martin Stjernholm, Roxen IS
Previous text:
2004-09-19 02:34: Subject: order of elements after: a^b
hi,
when i combine two arrays using exclusive or (^) the order of the resulting elements appears to be like (a+b)-(elements from both):
a = ({ 1, 7, 2, 8, 4 }); b = ({ 2, 1, 3, 0, 5 }); a^b is ({ 7, 8, 4, 3, 0, 5 })
however if there are doubles a = ({ 1, 7, 2, 5, 4 }); b = ({ 2, 1, 3, 5, 5 }); a^b is ({ 7, 4, 3, 5 }) b^a is ({ 3, 5, 7, 4 })
one of them remains. what's the strategy here?
it looks like from both arrays it removes always the same number of elements.
greetings, martin.
/ Brevbäraren
pike-devel@lists.lysator.liu.se