mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
New line or field iteration procedures in (ice-9 rdelim)
* NEWS: Update * module/ice-9/rdelim (for-rdelim-from-port, for-delimited-from-port, for-line-in-file): New procedures. * doc/ref/api-io.texi: Documentation of `for-rdelim-for-port`-related procedures. * test-suite/tests/rdelim.test: Tests for `for-rdelim-for-port`-related procedures. Signed-off-by: Mikael Djurfeldt <mikael@djurfeldt.com>
This commit is contained in:
parent
a9c079b13b
commit
c2829e4a86
4 changed files with 96 additions and 2 deletions
|
@ -984,6 +984,28 @@ used. This procedure is equivalent to:
|
|||
@end lisp
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} for-rdelim-from-port port proc rdelim-proc @
|
||||
[#:stop-pred=eof-object?]
|
||||
For every unit provided by @code{(rdelim-proc port)}, provide
|
||||
this unit(rdelim) to @var{proc} to be processed. This will continue throughout
|
||||
@var{port} until @var{stop-pred} returns @code{#t}.
|
||||
@var{stop-pred} is @code{eof-object?} by default.
|
||||
@var{rdelim-proc} has to advance through @var{port} with every call made to it.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} for-delimited-from-port port proc @
|
||||
[#:delims=''\n''] [#:handle-delim='trim]
|
||||
Call @var{proc} for every line delimited by @var{delims} from @var{port}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} for-line-in-file file proc @
|
||||
[#:encoding=#f] [#:guess-encoding=#f]
|
||||
Call @var{proc} for every line in @var{file}.
|
||||
@var{file} must be a filename string.
|
||||
|
||||
The line provided to @var{proc} is guaranteed to be a string.
|
||||
@end deffn
|
||||
|
||||
@node Default Ports
|
||||
@subsection Default Ports for Input, Output and Errors
|
||||
@cindex Default ports
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue