title: SML how to get while on char list to return int?
body: <p>I'm having a bit difficulty figuring out, how to get each of the processed chars back to an int value.</p>
  
  <p>The function should work like: val caesar = fn :  int * int -> int</p>
  
  <p>So if k = 2466 and n = 2, then the output should be 4688</p>
  
  <p>Hope the code isn't too weird (I'm a SML newbie). </p>
  
  <pre><code> (* Load Libs *)
      load "Int";
      load "Real";
      load "String";
      load "Char";
      load "List";
  
  
      fun caesar (k, n) =
        let
          fun k_string (i) = Int.toString(i)
          fun item_k_char (x, y) = Char.ord (List.nth (x, y))
  
          val val_k_string = k_string(k)
          val k_explode = String.explode(val_k_string)
          val counter = ref 0
          val counter_end = (String.size(val_k_string) - 1)
  
        in 
          while (!counter &gt;= counter_end) do (
            item_k_char(k_explode, !counter) + n;
            counter := !counter + 1
          )
        end;
  </code></pre>