title: Prolog Clear List of positive elements without using cuts
body: <p>I want to clear a list without cutting. I tried: </p>
  
  <pre><code>filter([],[]).
  
  filter([H|T],[H|S]) :- 
     H&lt;0,
     filter(T,S).
  
  filter([H|T],S) :- 
     H&gt;=0,
     filter(T,S).
  </code></pre>
  
  <p>But it doesn't work.</p>
  
  <p>Here is what happened when I tried:</p>
  
  <pre><code>?- filter([1,0,-6,7,-1],L).
  
  L = [-6,-1]; %false
  no
  
  L=[0,-6,-1] %true
  </code></pre>