title: Implementing a counter in SML
body: <p>I am trying to solve a polynomial evaluation problem on SML, here is the current code I have:</p>
  
  <pre><code>fun eval (nil, b:real) = 0.0
  |       eval(x::xs, a:real) = 
  let val y:real = 0.0
  fun inc z:real = z+1.0;
  in
     (x*Math.pow(a,(inc y))) + eval(xs,a)
  end;
  </code></pre>
  
  <p>The problem with this is that it only increments y once, is there a way to have y start at 0 and keep increasing by 1 with every recursion? </p>