title: Prolog, building list with conditional clauses
body: <p>I need to do this homework assignment using prolog (SWI-flavor) and cant get my head around some things. </p>
  
  <p>For example, if i want to iterate through a list and add its elements to another, but ONLY if they meet certain condition, how would I go about it? I can add them all, or none, but if I add clause that checks this condition, the whole recursion turns out as "false". I understand why this is, but have no idea how to fix it. Basically what i want is:</p>
  
  <pre><code>goal(Stuff) :- do_something(X),
                 only_do_this_if_something(Y),
                 always_do_this(Z).
  </code></pre>
  
  <p>Currently, if <code>only_do_this_if_something(Y)</code> fails, also <code>always_do_this(Z)</code> doesnt happen as the whole goal turns false...</p>