dinh@farside.twinsun.com (Dinh Le) (08/22/90)
This is the description of (read-char port) taken out of the R3R. Returns the next character available from the input port, update the port to point to the following character. If no more characters are available, an end of file object is returned. The report treats eof as a distinguished object since the only to way find out if an object is an eof object is to say (eof-object? obj). I find it convenience sometimes to be able to treat an eof object as a charater, say #\eof. For example, instead of writing ... (set! c (read-char)) (if (eof-object? c) (error "premature end of file") (case c ((a) ...) ((b c d) ...) ... I can write ... (set! c (read-char)) (case c ((#\eof) (error "premature end of file")) ((a) ...) ((b c) ...) ... which is much more elegant to me. Why isn't eof-object being treated as character in Scheme? Dinh Twin Sun, Inc. dinh@twinsun.com 360 N. Sepulveda Blvd. El Segundo, CA 90245