Hello, I am trying to learn SML, but drowning in its streams.
The following function does what I want in SML/NJ, but not in PolySML. Is the function wrong, but SML/NJ lenient and PolySML not? If the function is wrong, what is the best way to get input from stdin without a newline?
fun askName () = let val a = TextIO.inputLine TextIO.stdIn val b = String.translate (fn x => case x of #"\n" => ""|_ => str(x)) in case a of SOME("\n") => NONE | SOME(s) => SOME (b s) | NONE => NONE end
Thanks Johan