Script started on Tue Nov 13 11:32:03 1990 ladybank% njml Standard ML of New Jersey, Version 0.44a, 13 December 1989 val it = () : unit - std_in; val it = - : instream - std_out; val it = - : outstream - output; val it = fn : outstream -> string -> unit - input; val it = fn : instream -> int -> string - input_line; val it = fn : instream -> string - open_in; val it = fn : string -> instream - open_out; val it = fn : string -> outstream - close_in; val it = fn : instream -> unit - close_out; val it = fn : outstream -> unit - - - - output_line; Error: unbound variable output_line - "I was only trying"; val it = "I was only trying" : string - use "io"; [opening io] val it = - : instream val it = - : outstream now type 4 characters val it = () : unit abcd val x = "abcd" : string val y = output std_out; (* look at value of y *) val y = () : unit val echo = fn : instream -> int -> unit val io = - : instream (*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)); fini val it = () : unit val it = () : unit val copy = fn : instream -> outstream -> int -> unit [closing io] val it = () : unit - - - val x = input std_in 4; Patrick Prosser val x = "Patr" : string - Error: unbound variable ick = ; Error: unbound variable Prosser - x; val it = "Patr" : string - val x = input std_in 4; Patrick val x = "Patr" : string - = ; Error: unbound variable ick - val x = im nput std_in 4; 1234567; val x = "1234" : string - val it = 567 : int - val x = input std_in 4; abc val x = "abc\n" : string - x; val it = "abc\n" : string - print x; abc val it = () : unit - - - input_line std_in; "Well, Hi there everybody" . Why bother with the quote? val it = "\"Well, Hi there everybody. Why bother with the quote?\n" : string - "Reckon I hit r backspace?"; val it = "Reckon I hit backspace?" : string - val x = input_line std_in; aaaaaaaa         val x = "\n" : string - x; val it = "\n" : string - val x = input_line std_in; Hi everybody val x = "Hi everybody\n" : string - val x = input_line std_in; """"""""" val x = "\"\"\"\"\"\"\"\"\"\n" : string - "Thats it, it does something funny with quote"; val it = "Thats it, it does something funny with quote" : string - - - copy std_in std_out 5; Ted, Alice, Poppy and Nelson are cats Ted, Alice, Poppy and Nelson are cats Nelson was named after Nelson Piquet, 3 times world champion Nelson was named after Nelson Piquet, 3 times world champion My wife (andrea) chose the name since she likes Piquet My wife (andrea) chose the name since she likes Piquet Nelson won the Japanese and Australian Grand Prix Nelson won the Japanese and Australian Grand Prix Nelson likes prawns, chickew n and smoked salmon Nelson likes prawns, chicken and smoked salmon val it = () : unit - ^Dladybank% exit ladybank% script done on Tue Nov 13 11:42:29 1990