title: First elements of list of list Prolog
body: <p>I m studying Prolog and i see this code </p>
  
  <pre><code>foo([],[]).
  foo([[A,_ ]|L], [A|P]) :-foo(L ,P).
  </code></pre>
  
  <p>The result say that this code take N element of list of list, 
  Ad example if we give this query:</p>
  
  <pre><code>?foo([[car],[house],[man]],X)
  X= [c,h,m]
  </code></pre>
  
  <p>At first read i see that something wrong. 
  For me this code take the tail of list of list and the rest of first element of the list , so for me first expansion will be  (trace)</p>
  
  <pre><code>foo([[house],[man]], ar)
  foo([[man]], ouse)
  foo([], an)
  false.
  </code></pre>
  
  <p>I try to compile with swi-prolog and give this trace:</p>
  
  <pre><code>[trace]  ?- trace,foo([[car],[house],[man]],X).
  Call: (9) foo([[car], [house], [man]], _1016) ? creep
  Fail: (9) foo([[car], [house], [man]], _1016) ? creep
  false.
  </code></pre>
  
  <p>What are I wrong?</p>