title: Generating integers < limit
body: <p>I am trying to generate all integers (natural numbers) smaller than a limit, let's say 10.
  I have a predicate <code>nat(X)</code> which produces all numbers from 0 to infinity.</p>
  
  <p>Now my problem is, if I do:</p>
  
  <pre><code>nat10(X) :- nat(X), X =&lt; 10.
  </code></pre>
  
  <p>This will never terminate, as it tries to find other solutions with <code>nat(X)</code> until infinity.</p>
  
  <p>I need a construct that let's me fail the whole predicate if one subgoal fails. How would I go about doing that?</p>