title: Prolog filter a list of all elements for which a custom goal fails
body: <p>I am trying to write a predicate <code>filter(List, PredName, Result)</code> that filters a <code>List</code> of all its elements for which the goal <code>PredName</code> fails and subsequently returns the <code>Result</code> list. The predicate <code>PredName/1</code> should be defined when calling the procedure <code>filter/3</code> and could for example be:</p>
  
  <pre><code>test(N) :- N &gt;= 0
  </code></pre>
  
  <p>A query could then be made like following:</p>
  
  <pre><code>?- filter([-6,7,-1,0], test, L)
  L = [7, 0];
  no
  </code></pre>