title: executing operation for each list element in swi-prolog and others
body: <p>How do I do an operation for each element of a list, in order?</p>
  
  <p>Based on these two resources:</p>
  
  <ol>
  <li><a href="http://www.swi-prolog.org/pldoc/doc/swi/library/lists.pl" rel="noreferrer">http://www.swi-prolog.org/pldoc/doc/swi/library/lists.pl</a></li>
  <li><a href="http://www.swi-prolog.org/pldoc/doc_for?object=foreach/2" rel="noreferrer">http://www.swi-prolog.org/pldoc/doc_for?object=foreach/2</a></li>
  </ol>
  
  <p>I imagine I can always rely on:</p>
  
  <ul>
  <li><code>foreach(member(X, [1,2]), write(X)).</code></li>
  </ul>
  
  <p>Is that deterministic and can I wrap the member/2 predicate as I please in my own predicates and still always iterate in order?</p>