Subscribe Bookmark RSS Feed

exclusive or for lists?

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.
2 REPLIES
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

Community Manager

Joined:

Jun 23, 2011

Associative arrays make this pretty simple:

-Jeff