title: Finding the max in a list - Prolog
body: <p>I was just introduced to Prolog and am trying to write a predicate that finds the Max value of a list of integers. I need to write one that compares from the beginning and the other that compares from the end. So far, I have:</p>
  
  <pre><code>max2([],R).
  max2([X|Xs], R):- X &gt; R, max2(Xs, X).
  max2([X|Xs], R):- X &lt;= R, max2(Xs, R).
  </code></pre>
  
  <p>I realize that R hasn't been initiated yet, so it's unable to make the comparison. Do i need 3 arguments in order to complete this?</p>