我是SML的新手(实际上是编程).
fun readlist (infile : string) =
let
val
ins = TextIO.openIn infile
fun loop ins =
case TextIO.inputLine ins of
SOME line => line :: loop ins
| NONE => []
in
loop ins before TextIO.closeIn ins
end ;
Run Code Online (Sandbox Code Playgroud)
这是我在这里遇到的一个程序.我如何使用SOME和NONE,以及如何使用'之前'?