IRC channel logs


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>how can I do that?
<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: maybe my advent-of-wisp-code solutions can give you pointers: — to use the solutions, just add parens to match the indentation, minus 1 for lines that start 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).