| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
port->string reads port
until EOF and returns the accumulated data as a string.
port->list applies reader on port repeatedly, until
reader returns an EOF, then returns the list of objects
reader returned.
(port->string-list port) ==
(port->list read-line port)
, and
(port->sexp-list port) ==
(port->list read port)
.
Suppose reader returns a series of items
{X0, X1, ..., Xn}.
port-fold returns the following:
(fn Xn (fn Xn-1 ... (fn X0 knil))) |
(fn X0 (fn X1 ... (fn Xn knil))) |
(port-fold cons '() read) returns a reverse
list of all the inputs, while (port-fold-right cons '() read)
returns the same thing as (port->list read port).
On the other hand, port-for-each and port-map
applies fn to each item. The former discards the results
fn returns, while the latter returns a list of results.