!iNkFOAFNSlAAUKgcCT:matrix.org

lisp

725 Members
All things lisp: cl, scheme, racket, clojure etc93 Servers

Load older messages


SenderMessageTime
26 Jun 2020
@ratman83:matrix.orgrat joined the room.20:54:56
27 Jun 2020
@pablo-pie:matrix.org@pablo joined the room.01:27:14
@pablo-pie:matrix.org@pablo left the room.01:35:03
28 Jun 2020
@oscar:matrix.kiwifarms.netoscar 21:31:18
30 Jun 2020
@nieve:privacytools.ionieve 06:54:57
1 Jul 2020
@ksroot:matrix.orgksroot left the room.16:15:17
2 Jul 2020
@carola:bau-ha.uscarola 08:23:48
@bheesham:matrix.orgbheesham joined the room.09:25:02
@kilian:utwente.iokilian joined the room.18:48:16
3 Jul 2020
@movsxd:matrix.orgmovsxd joined the room.20:17:43
@msavorritias:matrix.orgMSavoritias joined the room.21:47:26
4 Jul 2020
@lena:tomesh.netlena 09:55:52
@mrtn:hackeruniverse.dkMrtn DkIn 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:matrix.orghideyo(read-line)11:25:05
@hideyo:matrix.orghideyo * (read-line) from (ice-9 rdelim) module11:26:11
5 Jul 2020
@sfield:matrix.orgsfield joined the room.06:44:27
@mrtn:hackeruniverse.dkMrtn Dk
In reply to @hideyo:matrix.org
(read-line)
from (ice-9 rdelim) module
Thank you! That works great!
12:58:01
@mrtn:hackeruniverse.dkMrtn DkI 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:hackeruniverse.dkMrtn DkI tried (read-line <port> 'split), but it only splits the newline from the payload. 13:00:18
@mrtn:hackeruniverse.dkMrtn DkA 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:hackeruniverse.dkMrtn Dk(sorry for all the errors, but you get the point, I hope).13:05:50
@mrtn:hackeruniverse.dkMrtn Dk (string-filter (λ (c) (not (char=? c #\return))) (car (read-line (open-file "filename" "r") 'split)))13:06:52
@wklew:matrix.orgwalter changed their profile picture.16:26:06
@hideyo:matrix.orghideyo
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:hackeruniverse.dkMrtn Dkhideyo: Can you reproduce the error on your system?19:51:51
@mrtn:hackeruniverse.dkMrtn Dk hideyo: 19:52:06
@hideyo:matrix.orghideyo
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:hackeruniverse.dkMrtn 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:matrix.orghideyo

<@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:hackeruniverse.dkMrtn 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

Show newer messages


Back to Room ListRoom Version: