26 Jun 2020 |
| rat joined the room. | 20:54:56 |
27 Jun 2020 |
| @pablo joined the room. | 01:27:14 |
| @pablo left the room. | 01:35:03 |
28 Jun 2020 |
| oscar | 21:31:18 |
30 Jun 2020 |
| nieve | 06:54:57 |
1 Jul 2020 |
| ksroot left the room. | 16:15:17 |
2 Jul 2020 |
| carola | 08:23:48 |
| bheesham joined the room. | 09:25:02 |
| kilian joined the room. | 18:48:16 |
3 Jul 2020 |
| movsxd joined the room. | 20:17:43 |
| MSavoritias joined the room. | 21:47:26 |
4 Jul 2020 |
| lena | 09:55:52 |
Mrtn Dk | In Guile scheme, which command do you recommend for reading a line of text (from a file stored on a fixed disk, for instance)? | 11:24:12 |
hideyo | (read-line) | 11:25:05 |
hideyo | * (read-line)
from (ice-9 rdelim) module | 11:26:11 |
5 Jul 2020 |
| sfield joined the room. | 06:44:27 |
Mrtn Dk | In reply to @hideyo:matrix.org (read-line) from (ice-9 rdelim) module Thank you! That works great! | 12:58:01 |
Mrtn Dk | I have a small problem though, albeit I worked around the problem for now. The problem is, I get a #\return at the end of each line I read, if the file happens to be stored in "DOS" format. | 12:59:02 |
Mrtn Dk | I tried (read-line <port> 'split), but it only splits the newline from the payload. | 13:00:18 |
Mrtn Dk | A workaround is of cause very simple, for instance (let* ((lin (read-line port)) (len (string-length lin))) (set! lin (string-filter (lambda (c) (not (char=? c #\return)))) ;; or similar. | 13:03:39 |
Mrtn Dk | (sorry for all the errors, but you get the point, I hope). | 13:05:50 |
Mrtn Dk | (string-filter (λ (c) (not (char=? c #\return))) (car (read-line (open-file "filename" "r") 'split))) | 13:06:52 |
| walter changed their profile picture. | 16:26:06 |
hideyo | In reply to @mrtn:hackeruniverse.dk I have a small problem though, albeit I worked around the problem for now. The problem is, I get a #\return at the end of each line I read, if the file happens to be stored in "DOS" format. interesting. (read-line) is sort of standard for scheme, so we should maybe check how other implementation handle this (if #\return is omitted or not) and if it's different, maybe submit a bug report | 18:08:52 |
Mrtn Dk | hideyo: Can you reproduce the error on your system? | 19:51:51 |
Mrtn Dk | hideyo: | 19:52:06 |
hideyo | In reply to @mrtn:hackeruniverse.dk hideyo: Can you reproduce the error on your system? yes, and I tried it in guile, chez scheme (get-line) and racket. It works the same in every implementation, so this is not an error | 22:20:36 |
6 Jul 2020 |
Mrtn Dk | In reply to @hideyo:matrix.org yes, and I tried it in guile, chez scheme (get-line) and racket. It works the same in every implementation, so this is not an error How do you mean it is not an error? As in, you got a different result, or as in the last character of the string is supposed to be a #\return if reading a DOS-file ? | 02:07:12 |
hideyo |
<@hideyo:matrix.org> yes, and I tried it in guile, chez scheme (get-line) and racket. It works the same in every implementation, so this is not an error
How do you mean it is not an error? As in, you got a different result, or as in the last character of the string is supposed to be a #\return if reading a DOS-file ?
I got same result so \return is supposed to be the last character | 06:39:30 |
Mrtn Dk | In reply to @hideyo:matrix.org
<@hideyo:matrix.org> yes, and I tried it in guile, chez scheme (get-line) and racket. It works the same in every implementation, so this is not an error
How do you mean it is not an error? As in, you got a different result, or as in the last character of the string is supposed to be a #\return if reading a DOS-file ?
I got same result so \return is supposed to be the last character 😎👍 | 06:51:35 |