read | R5RS |
read port | R5RS |
Read converts external representations of Scheme objects into the
objects themselves. Read returns the next object parsable from the given
input port, updating port to point to the first character past the end of
the external representation of the object.
If an end of file is encountered in the input before any characters are found that can begin an object, then an end of file object is returned. The port remains open, and further attempts to read will also return an end of file object. If an end of file is encountered after the beginning of an object's external representation, but the external representation is incomplete and therefore not parsable, an error is signalled. The port argument may be omitted, in which case it defaults to the value
returned by |
read-with-shared-structure | STKLOS Procedure |
read-with-shared-structure port | STKLOS Procedure |
read-with-shared-structure is identical to read . It has been added to
be compatible with SRFI-38. STKLOS always knew how to deal with
recursive data.
|
read-char | R5RS |
read-char port | R5RS |
Returns the next character available from the input port , updating the port
to point to the following character. If no more characters are available,
an end of file object is returned. Port may be omitted, in which case
it defaults to the value returned by current-input-port .
|
peek-char | R5RS |
peek-char port | R5RS |
Returns the next character available from the input port , without updating
the port to point to the following character. If no more characters are
available, an end of file object is returned. Port may be omitted, in
which case it defaults to the value returned by current-input-port .
Note: The value returned by a call to |
eof-object? obj | R5RS |
Returns #t if obj is an end of file object, otherwise returns #f .
|
char-ready? | R5RS |
char-ready? port | R5RS |
Returns #t if a character is ready on the input port and returns #f
otherwise. If char-ready returns #t then the next read-char operation on
the given port is guaranteed not to hang. If the port is at end of file
then char-ready? returns #t . Port may be omitted, in which case it
defaults to the value returned by current-input-port .
|
read-line | R5RS |
read-line port | R5RS |
Reads the next line available from the input port port . This function
returns 2 values: the first one is is the string which contains the line
read, and the second one is the end of line delimiter. The end of line
delimiter can be an end of file object, a character or a string in case
of a multiple character delimiter. If no more characters are available
on port , an end of file object is returned. Port may be omitted,
in which case it defaults to the value returned by current-input-port .
Note: As said in See Multiple values, if |
port->string port | STKLOS Procedure |
port->sexp-list port | STKLOS Procedure |
port->string-list port | STKLOS Procedure |
All these procedure take a port opened for reading. Port->string reads
port until the it reads an end of file object and returns all the
characters read as a string. Port->sexp-list) and port->string-list
do the same things except that they return a list of S-expressions and
a list of strings respectively. For the following example we suppose that
file "foo" is formed of two lines which contains respectively the number
100 and the string "bar" .
(port->sexp-list (open-input-file "foo")) => (100 "bar") (port->string-list (open-input-file "foo")) => ("100" "\"bar\"") |