title: Prolog beginner. How to take list as parameter and pass it on
body: <p>I am a total beginner at Prolog. I am struggling with creating a rule, which takes a list as parameter and passes the list onto another rule. Here is my code: </p>
  
  <pre><code>combine([], '').
  combine([L|List], Total) :-
      combine(List, CombinedRest),
      atom_concat(L, CombinedRest, Total).
  
  findHeadline([W|Words], Combined) :- 
      combine(Words, Combined).
  
  findHeadline2([Words], Combined) :- 
      combine(Words, Combined).
  </code></pre>
  
  <p>findHeadline works as expected, but findHeadline2 does not. Here is the output:</p>
  
  <pre><code>1 ?- findHeadline([billig, enkeltmand], Combination).
  Combination = enkeltmand.
  
  2 ?- findHeadline2([billig, enkeltmand], Combination).
  false.
  </code></pre>
  
  <p>The output I was expecting from findHeadline was:</p>
  
  <pre><code>Combination = billigenkeltmand.
  </code></pre>
  
  <p>How can it be that this does not work?</p>
  
  <p>I tried to utilize trace in SWI-prolog, but it gave me no clue whatsoever, as the findHeadline rule just exits immediately and does not call the combine rule at all.</p>