IRC channel logs

2023-05-18.log

back to list of logs

<Zelphir>Copying from wrongly posted in #guix: Hello! I have a question regarding handling of data a program: I am trying to write a kind of "Guile shell", implementing things like `cd' or `ls' or `cut'. Usually such commands take their input from a file or stdin. I have the choice in my implementation, when making a pipeline of commands, to pass results as a list or write to a pipe output port, which I could make the current input port for the next command. I am
<Zelphir>wondering, what the cost of a huge
<Zelphir>result of a command is. Which way of passing the result would be better in terms of having to hold less data in memory. I mean, somehow the data must be held (unless I find a way to make streams or so), but, assuming data is just lines of text, is it more efficient to write data out to a port line by line and then read it in again in the next command, from the current input port, or would it be more efficient to pass as a list? I guess passing as a list
<Zelphir>would require to collect all results first, which might be bad for letting the commands run in parallel.
<Zelphir>Is there a way to pass data as not-a-string but structured data, but working like ports?
<Zelphir>(working like ports: being able to write to them and read from them, without having to write all the data at once.)
<Zelphir>I think it would be great for non-text data to not need to be parsed again.
<flatwhatson>sneek: later tell Zelphir if you don't need to inspect the data passing between processes, most efficient is to let the OS handle it with pipes. (ice-9 popen) has "pipeline" which does this for you.
<sneek>Will do.
<old>Who can answer questions about Debugging Traps ÉÉ
<old>??*
<andydude>How do I install guild?
<daviid>andydude: guild is installed as you install guile, both in the same dir, $prefix/bin - how did you install guile?
<andydude>daviid: figured it out I had to add "-dev"
<andydude>I'm trying to see if I can compile mes
<apteryx>what does the warning 'missing DT_GUILE_ENTRY' means when failing to load a .go byte compiled file?
<apteryx>a new Guix user is attempting to install but encounters this kind of warning right before a Guix error I've never seen: https://imgur.com/a/1jgzL2U
<apteryx>old: just ask, we'll see :-)
<apteryx>is (cons 'a 'b) the same as `(a . b) ?
<apteryx>yes
<RhodiumToad>well
<RhodiumToad>cons always makes a new pair, but '(a . b) refers to a possibly constant cell created by the reader
<apteryx>you mean their types may be different?
<apteryx>what is a constant cell?
<RhodiumToad>a constant cell doesn't like you doing set-car! or set-cdr! on it
<RhodiumToad>the result of cons will never compare eq? with any other pair
<Zelphir>Is there such a thing as an output port and input port for structured data, not merely strings? Or is the only way to write Scheme values and read them again?
<sneek>Welcome back Zelphir, you have 1 message!
<sneek>Zelphir, flatwhatson says: if you don't need to inspect the data passing between processes, most efficient is to let the OS handle it with pipes. (ice-9 popen) has "pipeline" which does this for you.
<Zelphir>Is there a way to pass data between processes without having to serialize and deserialize it?
<Zelphir>flatwhatson: Thanks! I think that will be the way to go, if there is no way to pass the data without serialization and deserialization.
<andydude>It think Racket replaces all pairs with immutable pairs
<apteryx>RhodiumToad: thanks
<apteryx>does a #f status:exit-value always signify something went wrong, e.g. an error raised?
<old>apteryx: it either means the process was terminated with a signal (status:term-sig) or it is stopped (status:term-stop)
<old>so kind of yes, at the exception when the process is stopped
<apteryx>OK; and can status:exit-value throw an exception in some cases?
<apteryx>instead of returning #f
<old>apteryx: looking at the source code, it use WIFEXITED + WEXISTATUS
<old>other it returns SCM_BOOL_F
<old>so no
<old>s/other/otherwise
<apteryx>OK! thanks for checking
<apteryx>the code returning result to check with status:exit-value is a thunk, which can contain anything
<apteryx>e.g. a system or system* call, or any other scheme code to execute
<apteryx>so I think in that case status:exit-val needs to be prepared to accept junk
<apteryx>while it expects an integer
<apteryx>currently it's wrappend in a false-if-exception
<apteryx>*wrapped
<old>right, it has to be a integer has returned by the OS
<old>like most Scheme procedure, they can return exception if the input is invalid
<old>dues to runtime type checking in C
<apteryx>I see!
<mirai>whom should I pester in order to get a few patches to guile noticed?