Next Previous Up Top Contents Index

5.6 Reading from and writing to streams

5.6.2 Convenience functions for reading from streams

The following is a small set of reading functions that search for particular elements in a stream. These functions behave as though they were implemented in terms of the more primitive functions described in Section 5.6.1.

read-to

Function

read-to input-stream element #key on-end-of-stream test 
=> sequence-or-eof found? 

Returns a new sequence containing the elements of input-stream from the stream's current position to the first occurrence of element, but not element itself.
found? is #t if the read terminated with element, or #f if the read terminated by reaching the end of the stream's source. The stream is left positioned after element.

See also read-through, page 88.

read-to-end

Function

read-to-end input-stream => sequence 

Returns a sequence of all the elements up to, and including, the last element of input-stream, starting from the stream's current position.
skip-through

Function

skip-through input-stream element #key test => found? 

Positions input-stream after the first occurrence of element, starting from the stream's current position. Returns #t if the element was found, or #f if the end of the stream was encountered. When skip-through does not find the element, it leaves input-stream positioned at the end of the stream.

System and I/O Reference - 31 MAR 2000

Next Previous Up Top Contents Index