title: Prolog Remove element from list
body: <p>I have the following fact to remove all occurences of a element in a list. Although the output is correct, the element is just replaced for a blank space</p>
  
  <pre><code>remover( _, [], []).
  remover( R, [R|T], [T2]) :- remover( R, T, T2).
  remover( R, [H|T], [H|T2]) :- H \= R, remover( R, T, T2).
  </code></pre>
  
  <p>When I call remover the output is :</p>
  
  <pre><code>remover(3,[1,2,3,4,3],Res)
  Res = [1, 2, [4, []]]
  </code></pre>
  
  <p>I also have the following fact to remove only the first occurence but the output is the same from above</p>
  
  <pre><code>remover_primeira( _, [], []).
  remover_primeira( R, [R|T], [T2]) :-remover_primeira( R, T, T2),!.
  remover_primeira( R, [H|T], [H|T2]) :- H \= R, remover_primeira( R, T, T2).
  
  </code></pre>
  
  <p>What am I doing wrong?</p>