(*io*) std_in; (* is the standard input stream, namely the keyboard *) std_out; (* is the standard output stream, namely the screen *) output std_out "now type 4 characters\n"; (* Writes to screen *) val x = input std_in 4; (* read 4 characters from keyboard, assign to x *) val y = output std_out "val y = output std_out; (* look at value of y *)\n"; fun echo in_file 0 = output std_out "fini\n" |echo in_file lines = (output std_out (input_line in_file); echo in_file (lines - 1)); (* Note that function "input_line" reads an entire line. This fn is supplied by ml. Note the use of (expression-1;expression-2; ....;expression-n) *) val io = open_in "io"; (* That is this file!! *) echo io 30; (* should list most, if not all, of this file on screen *) close_in io; fun copy from to 0 = () |copy from to n = (output to (input_line from); copy from to (n-1));