open TextIO; (* i.e. the I/O library *) fun cat fileName = let fun f inS = if endOfStream inS then ( closeIn inS; print "\n" ) else ( print (inputN(inS, 1)); f inS ) in f(openIn fileName) end; (* e.g. *) cat "cat.sml"; (* Copy file to std output, L.A., 11/4/2005 *) (* Also see I/O, Ch 4, *) (* Ullman "Elements of ML Programming" 1998 *)