title: Removing duplicates in prolog
body: <p>I'm fairly new to prolog and I'm currently reading through a book which is giving me practice examples to code. It has tasked me with removing duplicates.</p>
  
  <p>Note: I have read other stackoverflows, and I understand how to remove duplicates but what I don't understand is why my code isn't working. ( I have chose a different approach to other stackoverflows)</p>
  
  <p>I've created a is_member predicate which I believe works fine.</p>
  
  <pre><code>is_member(X, [Head,Tail]):-
      X == Head;
      is_member(X, Tail).
  </code></pre>
  
  <p>And then my remove_duplicates predicate</p>
  
  <pre><code>remove_duplicates([Head|Tail], Without):-
      is_member(Head, Tail),
      remove_duplicates(Tail, Without);
      remove_duplicates(Tail, Head).
  </code></pre>
  
  <p>In my head this makes sense, it checks if the Head is a member of the tail and if it is, it doesn't add it to the Without list,</p>
  
  <p>else it does.</p>
  
  <p>I'm obviously missing something trivial here,</p>
  
  <p>Thanks in advance</p>