title: Prolog union for A U B U C
body: <p>I've started to learn Prolog recently and I can't solve how to make union of three lists.</p>
  
  <p>I was able to make union of 2 lists :</p>
  
  <pre><code>%element
  element(X,[X|_]).
  element(X,[_|Y]):-
                 element(X,Y).
  
  %union
  
  union([],M,M).
  union([X|Y],L,S) :- element(X,L),union(Y,L,S).
  union([X|Y],L,[X|S]) :- (not(element(X,L))),union(Y,L,S).
  </code></pre>
  
  <p>can anybody help me please ?</p>