title: Prolog, split list into two lists
body: <p>I got a problem with lists. What I need to do is to split one list <code>[1,-2,3,-4]</code>, into two lists <code>[1,3]</code> and <code>[-2,-4]</code>. My code looks like the following:        </p>
  
  <pre><code>lists([],_,_).
  lists([X|Xs],Y,Z):- lists(Xs,Y,Z), X&gt;0 -&gt; append([X],Y,Y) ; append([X],Z,Z).
  </code></pre>
  
  <p>and I'm getting </p>
  
  <pre><code>Y = [1|Y],
  Z = [-2|Z].
  </code></pre>
  
  <p>What am I doing wrong?</p>