title: how to pass a list in a predicate in prolog
body: <p>I want to store a paragram as a list in a variable and then call that list for counting how many times a particular word appears in that paragraph.</p>
  
  <p>However, when I do this:</p>
  
  <pre><code>L = [hello,hello,hello].
  
  counthowmany(_, [], 0) :- !.
  counthowmany(X, [X|Q], N) :- !, counthowmany(X, Q, N1), N is N1+1.
  counthowmany(X, [_|Q], N) :- counthowmany(X, Q, N).
  </code></pre>
  
  <p>... and compile buffer, and then ask this:</p>
  
  <pre><code>counthowmany(hello,L,N). 
  </code></pre>
  
  <p>The number of "hello" occurrences in the list doesn't show, instead I receive a warning:</p>
  
  <pre><code>singleton variable:[X]
  </code></pre>