Next Previous Up Top Contents Index

5.11 The STREAMS module

read-to

Function

Summary

Returns a sequence containing the elements of the stream up to, but not including, the first occurrence of a given element.

Signature

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

Arguments

input-stream
An instance of <stream>.

element
An instance of <object>.

on-end-of-stream
An instance of <object>.

test
An instance of <function>. Default value: ==.

Values

sequence-or-eof
An instance of <sequence>, or an instance of <object> if the end of the stream is reached.

found?
An instance of <boolean>.

Library

io

Module

streams

Description

Returns a new sequence containing the elements of input-stream from the stream's current position to the first occurrence of element. The result does not contain element.

The second return value is #t if the read terminated with element, or #f if the read terminated by reaching the end of the stream's source. The "boundary" element is consumed, that is, the stream is left positioned after element.

The read-to function determines whether the element occurred by calling the function test. This function must accept two arguments, the first of which is the element retrieved from the stream first and the second of which is element.

The type of the sequence returned is the same that returned by read. The end-of-stream behavior is the same as that of read-element.

See also

read-element, page 44


System and I/O Reference - 31 MAR 2000

Next Previous Up Top Contents Index