title: Working with list of lists in Prolog
body: <p>Please help me to solve this problem:
  I have a list of lists </p>
  
  <blockquote>
    <p>[[1,2],[3,4]]</p>
  </blockquote>
  
  <p>How do I get: </p>
  
  <blockquote>
    <p>[1,3]</p>
    
    <p>[1,4]</p>
    
    <p>[2,3]</p>
    
    <p>[2,4]</p>
  </blockquote>
  
  <p>Or if I have a list of lists</p>
  
  <blockquote>
    <p>[[1,2],[3,4],[6,7]]</p>
  </blockquote>
  
  <p>How do I get: </p>
  
  <blockquote>
    <p>[1,3,6]</p>
    
    <p>[1,3,7]</p>
    
    <p>[1,4,6]</p>
    
    <p>[1,4,7]</p>
    
    <p>[2,3,6]</p>
    
    <p>[2,3,7]</p>
    
    <p>[2,4,6]</p>
    
    <p>[2,4,7]</p>
  </blockquote>