IRC channel logs
2022-08-27.log
back to list of logs
<davidl>Hi, Im a bit of a guile noob. I need to loop through lines and return all of them until I reach a certain string. I want to write "(unless (string == "some-string) return string)" - so to speak. <davidl>i.e. the order is important. I have used (read-string (open-input-file "some-file.blah"), and want to write that file back to another location without the lines after some line X. <lilyp>davidl: the schemey way would be a named let: (let loop (bindings ...) (cond (<check for eof> lines) (<check for string reached> lines) (else (loop ...)))) <davidl>lilyp: thx. Ill see what I can come up with <ArneBab>davidl: the map-over-lines procedure shows how you can do that (though at least one person here thinks you should not factor this out as procedure).