# chickadee » srfi-1 » lset-xor

##### Identifier search
lset-xor = list_1 ...procedure

Returns the exclusive-or of the sets, using = for the element-equality procedure. If there are exactly two lists, this is all the elements that appear in exactly one of the two lists. The operation is associative, and thus extends to the n-ary case -- the elements that appear in an odd number of the lists. The result may share a common tail with any of the LIST_I parameters.

More precisely, for two lists A and B, A xor B is a list of

• every element A of A such that there is no element B of B such that (= A B), and
• every element B of B such that there is no element A of A such that (= B A).

However, an implementation is allowed to assume that = is symmetric -- that is, that

(= A B) => (= B A).

This means, for example, that if a comparison (= A B) produces true for some A in A and B in B, both A and B may be removed from inclusion in the result.

In the n-ary case, the binary-xor operation is simply folded across the lists.

```(lset-xor eq? '(a b c d e) '(a e i o u)) => (d c b i o u)

;; Trivial cases.
(lset-xor eq?) => ()
(lset-xor eq? '(a b c d e)) => (a b c d e)```