open TextIO; (* test if a character is white space *) fun white(" ") = true | white("\t") = true | white("\n") = true | white(_) = false fun getWord(file) = (* read one word *) if endOfStream(file) then "" else let val c = inputN(file,1) in if white(c) then "" else c^getWord(file) end; fun getList1(file) = (* read all words from an instream *) if endOfStream(file) then nil else getWord(file) :: getList1(file); (* read all words from a file given the file name *) fun getList(filename) = getList1(openIn(filename));