| eof-object?(3scm) | Scheme Programmer's Manual | eof-object?(3scm) |
NAME
eof-object? - test if an object is the end-of-file objectLIBRARY
(import (rnrs)) ;R6RS (import (rnrs io ports)) ;R6RS (import (rnrs io simple)) ;R6RS (import (scheme r5rs)) ;R7RS (import (scheme base)) ;R7RS
SYNOPSIS
(eof-object? obj)
DESCRIPTION
Returns #t if obj is an end-of-file object, otherwise returns #f.The end-of-file object is returned by various I/O procedures when they reach end of file.
RETURN VALUES
Returns a single boolean object.EXAMPLES
(eof-object? (eof-object))
=> #t
(eof-object? #\space)
=> #f
APPLICATION USAGE
This procedure is used on the result of I/O read operations, such as read(3scm), to see if the port has an end-of-file condition. It also appears in the context of generators (e.g. SRFI 158).COMPATIBILITY
There is a slight difference between R6RS and the other reports.- R4RS, IEEE Scheme, R5RS, R7RS
- The precise set of end-of-file objects will vary among implementations, but in any case no end-of-file object will ever be an object that can be read in using read.
- No object which satisfies this predicate satisfies any of these predicates: boolean?, bytevector?, char?, null?, number?, pair?, port?, procedure?, string?, symbol?, vector?, or any record type predicate.
- R6RS
- There is a unique end-of-file object. (This also satisfies the R7RS requirements).
ERRORS
This procedure can raise exceptions with the following condition types:- &assertion (R6RS)
- The wrong number of arguments was passed.
- R7RS
- The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.
SEE ALSO
eof-object(3scm)STANDARDS
R4RS, IEEE Scheme, R5RS, R6RS, R7RSHISTORY
This procedure was unchanged in Scheme from R2RS (AI Memo No. 848, 1985) until R6RS, which is when the end-of-file object became a unique object for the first time. R7RS branched off from R5RS and did not adopt the R6RS semantics for this object.LISP 1.5 had an end-of-file character that printed as $EOF$ and an end-of-record character that printed as $EOR$. PDP-10 MacLISP had an optional other argument to read that let the program specify its own end-of-file object. Scheme before R2RS would have used this implementation of read.
AUTHORS
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.| 2021-03-05 |