[MLton] Bug? print statement makes program terminate / run-forever

Wesley W. Terpstra wesley at terpstra.ca
Wed Jun 24 10:03:57 PDT 2009


Depending on if the 'print' statement is present, the program either
loops forever or terminates rapidly.

val x = 5.0
fun sqrtx y =
   let
      val y' = ((x / y + y) / 2.0)
      val () = print (Real.toString y ^ " ...\n")
   in
      if Real.== (y', y) then y else sqrtx y'
   end

val () = print (Real.toString (sqrtx 2.0) ^ "\n")



More information about the MLton mailing list