title: how to generate all combinations of 2 lists in prolog
body: <p>I need to generate combinations of 2 lists which have 4 elements each.</p>
  
  <p>For example, <code>list([1,2,3,4],[x,y,w,z],L).</code> should return</p>
  
  <p><code>L = [(1,x),(1,y),(1,w),(1,z),(2,x),(2,y)|...]</code> as the answer.</p>
  
  <p>This is my code:</p>
  
  <pre><code>comb([],[],[]).
  comb([H1|_],[H2|_],[H1|H2]).
  comb([_|T1],[_|T2],L):- comb(T1,T2,L).
  </code></pre>
  
  <p>... and it prints:</p>
  
  <pre><code>L = [1|y] ;
  L = [2|x] ;
  L = [].
  </code></pre>
  
  <p>... which is not the correct answer. Can someone help me to fix this?</p>