Re: [PATCH v3] rdelim: Add new procedure `for-line-in-file`.

2024-12-16 Thread Nala Ginrut
> > I know you were told that it should close the port, but I am not sure > about it. It should close the port it opened, but should it also the > one it got? This will prevent the same port being processed multiple > times, which could be annoying. > I'm sorry folks, I regretted to give this su

Re: [PATCH v2] rdelim: Add new procedure `for-line-in-file`.

2024-12-16 Thread Nala Ginrut
The faces icons are my speaking freedom as part of text. I grown up in a dictatorship place, they don’t even let me stop typing faces 😁 and no one told me smile faces make things worse. It is interesting to hear it first time in my life. “Well enough to go” means there is enough efforts to show an

RE: [PATCH v3] rdelim: Add new procedure `for-line-in-file`.

2024-12-16 Thread Maxime Devos
>I think the port would leak if PROC were to raise an exception. To my knowledge, this is currently kind of impossible to properly handle, since Scheme doesn’t have ‘finally’. Closest thing is ‘dynamic-wind’ + close it in the ‘out-guard’, but that isn’t quite right since (re)winding can happen

RE: [PATCH v2] rdelim: Add new procedure `for-line-in-file`.

2024-12-16 Thread Maxime Devos
>I'm not going to pursued anyone here, just sharing my opinion about a patch >for line parsing in a text file.😄 Then maybe you should stop it with the faces (“😄”) and strawmen. The faces just make things worse. >Yes, some of the parsers don need backwards, but it also doesn't mean others >parser

Re: [PATCH v3] rdelim: Add new procedure `for-line-in-file`.

2024-12-16 Thread Ricardo Wurmus
Adam Faiz writes: > +(define* (for-line-in-file file proc > + #:key (encoding #f) (guess-encoding #f)) > + "Call PROC for every line in FILE until the eof-object is reached. > +FILE can either be a filename string or an already opened input port. > +The corresponding po

Re: [PATCH v3] rdelim: Add new procedure `for-line-in-file`.

2024-12-16 Thread Tomas Volf
Adam Faiz writes: > From fe113e9efc08aae2a7e3792a1018c496212bd774 Mon Sep 17 00:00:00 2001 > From: AwesomeAdam54321 > Date: Sun, 15 Dec 2024 23:48:30 +0800 > Subject: [PATCH v3] rdelim: Add new procedure `for-line-in-file`. > > * module/ice-9/rdelim.scm (for-line-in-file)

Re: [PATCH v2] rdelim: Add new procedure `for-line-in-file`.

2024-12-16 Thread Nala Ginrut
I'm not going to pursued anyone here, just sharing my opinion about a patch for line parsing in a text file.😄 Yes, some of the parsers don need backwards, but it also doesn't mean others parsers have priority to occupy a general API. To my experience, a parser author like me prefer to write own p

RE: [PATCH v2] rdelim: Add new procedure `for-line-in-file`.

2024-12-16 Thread Maxime Devos
>You raised this topic from string line reading to more general case. 😄 Yes. >If so, the best way could be providing a general function to wrap rdelim for >for-each-seg-delim, users may pass a delimiter to decide how to delim (even >for bytevectors), and implement for-line-a-file base on it with

Re: [PATCH v2] rdelim: Add new procedure `for-line-in-file`.

2024-12-16 Thread Nala Ginrut
You raised this topic from string line reading to more general case. 😄 If so, the best way could be providing a general function to wrap rdelim for for-each-seg-delim, users may pass a delimiter to decide how to delim (even for bytevectors), and implement for-line-a-file base on it with unicode en

RE: [PATCH v2] rdelim: Add new procedure `for-line-in-file`.

2024-12-16 Thread Maxime Devos
This is overly specific to reading lines, and reading lines with rdelim. If you replace ‘read-line’ by an argument, the procedure becomes more general. For example, by passing ‘get-char’ you can act on each character, with ‘get-line’ I’m not sure what the difference would be, but apparently it’

[PATCH v3] rdelim: Add new procedure `for-line-in-file`.

2024-12-16 Thread Adam Faiz
>From fe113e9efc08aae2a7e3792a1018c496212bd774 Mon Sep 17 00:00:00 2001 From: AwesomeAdam54321 Date: Sun, 15 Dec 2024 23:48:30 +0800 Subject: [PATCH v3] rdelim: Add new procedure `for-line-in-file`. * module/ice-9/rdelim.scm (for-line-in-file): Add it. This procedure makes it convenient to

Re: rdelim: Add new procedure `for-line-in-file`.

2024-12-15 Thread Ricardo Wurmus
Hi Adam, > On 12/16/24 00:57, Ricardo Wurmus wrote: >> Hi Adam, >> >> has this patch been discussed somewhere else? I'm asking because I have >> no context other than this patch. > > No, actually. Was I supposed to discuss it's use in the patch cover letter? No, there is no requirement to do so

Re: [PATCH v2] rdelim: Add new procedure `for-line-in-file`.

2024-12-15 Thread Nala Ginrut
Hi Adam! For string manipulation, the proper encoding has to be considered. It's better to use the provided [#:guess-encoding=#f] [#:encoding=#f] as well. You may take a look at call-with-input-file in document: https://www.gnu.org/software/guile/manual/html_node/File-Ports.html BTW, in your case,

[PATCH v2] rdelim: Add new procedure `for-line-in-file`.

2024-12-15 Thread Adam Faiz
>From c8a9904f1b1c09d148de1ec23dc2eb0d433b3141 Mon Sep 17 00:00:00 2001 From: AwesomeAdam54321 Date: Sun, 15 Dec 2024 23:48:30 +0800 Subject: [PATCH v2] rdelim: Add new procedure `for-line-in-file`. * module/ice-9/rdelim.scm (for-line-in-file): Add it. This procedure makes it convenient to

Re: [PATCH v1] rdelim: Add new procedure `for-line-in-file`.

2024-12-15 Thread Nala Ginrut
00:00 2001 > From: AwesomeAdam54321 > Date: Sun, 15 Dec 2024 23:48:30 +0800 > Subject: [PATCH v1] rdelim: Add new procedure `for-line-in-file`. > > * module/ice-9/rdelim.scm (for-line-in-file): Add it. > > This procedure makes it convenient to do per-line processing of a text >

[PATCH v1] rdelim: Add new procedure `for-line-in-file`.

2024-12-15 Thread Adam Faiz
>From 3c7e1af1f4812d0e4c5d10e841cf9546e5ba2887 Mon Sep 17 00:00:00 2001 From: AwesomeAdam54321 Date: Sun, 15 Dec 2024 23:48:30 +0800 Subject: [PATCH v1] rdelim: Add new procedure `for-line-in-file`. * module/ice-9/rdelim.scm (for-line-in-file): Add it. This procedure makes it convenient to

Re: rdelim: Add new procedure `for-line-in-file`.

2024-12-15 Thread Adam Faiz
this patch was to make it convenient for other Scheme programmers to do per-line processing of a text file, if they need to do so. >> From 18485a2b94595ae2239f5dcdeb06d3a80bb04bf1 Mon Sep 17 00:00:00 2001 >> From: AwesomeAdam54321 >> Date: Sun, 15 Dec 2024 23:48:30 +0800 >&

RE: rdelim: Add new procedure `for-line-in-file`.

2024-12-15 Thread Maxime Devos
>Where is BREAK defined? Break is defined by ‘while’: https://www.gnu.org/software/guile/manual/html_node/while-do.html

Re: rdelim: Add new procedure `for-line-in-file`.

2024-12-15 Thread Ricardo Wurmus
] 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 d2cd081

rdelim: Add new procedure `for-line-in-file`.

2024-12-15 Thread Adam Faiz
>From 18485a2b94595ae2239f5dcdeb06d3a80bb04bf1 Mon Sep 17 00:00:00 2001 From: AwesomeAdam54321 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 |