I am trying to write a method that when called, given a string list and the name of the output file, will output each element to the output file in SML. I have tried this, but it doesn't seem to work.
fun quit(outFile: string, list: string list) =
let
val outStream = TextIO.openOut outFile
fun out(xs : string list) =
case xs of
[] => (TextIO.closeOut outStream)
| x::xs' => (TextIO.output(outStream, x); out(xs'))
in
out(list)
end