Task
Given two sets A and B, compute 



(
A
∖
B
)
∪
(
B
∖
A
)
.


{\displaystyle (A\setminus B)\cup (B\setminus A).}



That is, enumerate the items that are in A or B but not both. This set is called the symmetric difference of A and B.

In other words: 



(
A
∪
B
)
∖
(
A
∩
B
)


{\displaystyle (A\cup B)\setminus (A\cap B)}

 (the set of items that are in at least one of A or B minus the set of items that are in both A and B).

Optionally, give the individual differences (



A
∖
B


{\displaystyle A\setminus B}

 and 



B
∖
A


{\displaystyle B\setminus A}

) as well.



Test cases
A = {John, Bob, Mary, Serena}
B = {Jim, Mary, John, Bob}



Notes
 If your code uses lists of items to represent sets then ensure duplicate items in lists are correctly handled. For example two lists representing sets of a = ["John", "Serena", "Bob", "Mary", "Serena"] and b = ["Jim", "Mary", "John", "Jim", "Bob"] should produce the result of just two strings: ["Serena", "Jim"], in any order.
 In the mathematical notation above A \ B gives the set of items in A that are not in B; A ∪ B gives the set of items in both A and B, (their union); and A ∩ B gives the set of items that are in both A and B (their intersection).


 
(import (scheme base)
        (scheme write))
 
;; -- given two sets represented as lists, return (A \ B)
(define (a-without-b a b)
  (cond ((null? a) 
         '())
        ((member (car a) (cdr a)) ; drop head of a if it's a duplicate
         (a-without-b (cdr a) b))
        ((member (car a) b) ; head of a is in b so drop it
         (a-without-b (cdr a) b))
        (else ; head of a not in b, so keep it
          (cons (car a) (a-without-b (cdr a) b)))))
 
;; -- given two sets represented as lists, return symmetric difference
(define (symmetric-difference a b)
  (append (a-without-b a b)
          (a-without-b b a)))
 
;; -- test case
(define A '(John Bob Mary Serena))
(define B '(Jim Mary John Bob))
 
(display "A\\B: ") (display (a-without-b A B)) (newline)
(display "B\\A: ") (display (a-without-b B A)) (newline)
(display "Symmetric difference: ") (display (symmetric-difference A B)) (newline)
;; -- extra test as we are using lists
(display "Symmetric difference 2: ") 
(display (symmetric-difference '(John Serena Bob Mary Serena)
                               '(Jim Mary John Jim Bob))) (newline)
 