title: Prolog Length of Evens in a List
body: <p>I am a Prolog beginner, and I have the following length function:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>mylen([H|Lc],N) :- mylen(Lc,M),N is M+1.
  mylen([],0).</code></pre>
  </div>
  </div>
  </p>
  
  <p>I would like to know if there's an easy way to query the interpreter to calculate the length of the list of evens in a list, and if not, how I would go about incrementing N only on an even number. Thanks.</p>