title: Sum of elements in list in Prolog
body: <pre><code>list_sum([], 0).
  list_sum([Head | Tail], TotalSum) :-
      list_sum(Tail, Sum1),
      Total = Head + Sum1.
  </code></pre>
  
  <p>This code returns <code>true</code>. If I replace <code>Total = Head + Sum1</code> with <code>Total is Head + Sum1</code>, then it will return the value. But what I should replace it with to get the result like this:</p>
  
  <pre><code>?- list_sum([1,2,0,3], Sum).
  Sum = 1+2+0+3 ; % not to return value 6!!!
  </code></pre>