title: How can I combine format and print in prolog?
body: <p>How can I combine format and print in prolog? </p>
  
  <p>Basically, I pretend to print a message like "Element 5 occurs 3 times" in prolog. Number 5 and 3 depends of the execution.</p>
  
  <p>In Python, it would be like:</p>
  
  <pre><code>print("Element %d occurs %d times" % (element, occurrences))
  </code></pre>
  
  <p>For example, in a small example like:</p>
  
  <pre><code>count_occur(X, [], N) :- write("Element ??X occurs ??N times.").
  </code></pre>