Hi Adam, has this patch been discussed somewhere else? I'm asking because I have no context other than this patch.
> From 18485a2b94595ae2239f5dcdeb06d3a80bb04bf1 Mon Sep 17 00:00:00 2001 > From: AwesomeAdam54321 <adam.f...@disroot.org> > Date: Sun, 15 Dec 2024 23:48:30 +0800 > Subject: [PATCH] rdelim: Add new procedure `for-line-in-file`. > > * module/ice-9/rdelim.scm (for-line-in-file): Add it. > --- > module/ice-9/rdelim.scm | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/module/ice-9/rdelim.scm b/module/ice-9/rdelim.scm > index d2cd081d7..ffa38efad 100644 > --- a/module/ice-9/rdelim.scm > +++ b/module/ice-9/rdelim.scm > @@ -206,3 +206,15 @@ characters to read. By default, there is no limit." > line) > (else > (error "unexpected handle-delim value: " handle-delim))))) > + > +;;; for-line-in-file [PORT BODY] calls BODY (a procedure with the > +;;; line from PORT as it's argument) for every line until the > +;;; eof-object is reached. The line provided to BODY is guaranteed > +;;; to be a string. > + > +(define (for-line-in-file file body) > + (while #t > + (let ((line (read-line file))) > + (if (string? line) > + (body line) > + (break))))) It is preferrable to use a docstring instead of a comment. The choice of argument names is inconsistent, though. You're using PORT in the comment and FILE in the definition. BODY as a name for a procedure is also a rather "inspired" choice. Where is BREAK defined? -- Ricardo