Discussions
Categories
Groups
Help
Home
User Community
Discussions
exclusive or for lists?
unknown
Hi Guys,
I have two lists:
I want a final list with b,c,d as list elements. Can I do an exclusive or of the two lists to get that?
Thanks.
Accepted answers
All comments
unknown
Provided neither list contains any duplicate elements, the following ought to do the trick:
=1, i--,
j = contains(listb, lista[i]);
if(j > 0, remove from(lista, i); remove from(listb, j))
);
sort list(lista || listb)
);
OneOrOtherOnly = ExclusiveOr(SomeNames, MoreNames);
show(OneOrOtherOnly);
-->
There's probably a neater way to do it than this, so if anybody can see one I'd be interested.
Jeff_Perkinson
Associative arrays make this pretty simple:
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Help
Best Of