IRC channel logs


back to list of logs

<leoprikler>can we do something about the name tho? fash sounds a little fashy
<dokma>I'm having issues posting to this channel. Can anyone see this?
<sneek>dokma, you have 1 message!
<sneek>dokma, lfam says: With Guix, install the gcc-toolchain package in order to compile things by hand
<wilfred>dokma: I can see your message
<dokma>Back to my issue. I'm trying to figure out how to shutdown a server started by run-server from the repl module.
<dokma>I don't see any way to do it from the source.
<dokma>I've embedded the repl into my C++ app and it works as expected. But I cannot shut it down.
<dokma>I have tried (stop-server-and-clients!) from the repl but all it does is it closes my current repl session and I can connect right back in. In other words, run-server is still running.
<leoprikler>dokma: (quit)?
<dokma>leoprikler: it just closes my current repl session.
<dokma>It doesn't stop run-server. I can connect right back.
<dokma>I suppose that there should be a way to shutdown the repl server properly without killing the C++ host?
<dokma>Or am I wrong?
<leoprikler>I think you need to run stop-server-and-clients! on the server side somehow, but I'm not sure whether that power is handed to every connecting repl
<leoprikler>it also shuts down if you somehow find the port and close it, apparently
<leoprikler>Perhaps the comment in L38 hints at the culprit tho
<leoprikler>or no, the server-socket is probably never closed, because it's not in open-sockets
<leoprikler>well, nope, it's the first to be added to *open-sockets*
<dokma>leoprikler: I've implemented a C++ function that I can call from the repl.
<dokma>I can call stop-server-and-clients! from there.
<dokma>But I don't see how that would make a difference as opposed to just calling it from the repl.
<leoprikler>I'm not sure, but the server might think you no longer care about the evaluation if your client exits and thus stop early
<dokma>leoprikler: I totally didn't understand this last line
<dokma>I'm a scheme noob. Just for the record.
<leoprikler>Try to do good ol' printf debugging in stop-server-and-clients!
<dokma>Will try that too...
<leoprikler>in particular make it spit out the sockets it closes on your server
<leoprikler>(in some place you can retrieve the logs from)
<leoprikler>apparently the server socket is also closed when you throw sigint on the server side
<dokma>Can I throw sigint from the repl?
<leoprikler>you have a guile repl, you can probably get shell access through it too
<leoprikler>try (kill (getpid) SIGINT)
<dsmith>leoprikler: "fash the stampede" ?
<sandwich>i'm writing some procedures in c to use as callbacks. i want them to share local variables without having a userdata pointer passed. in scheme, i could just use closures. but what do I do here? i could just make wrapper procedures in scheme that use closures and pass the local variable to the c functions, is that the best way?
<ArneBab>Please let us NEVER EVER do something like Python3. I just lost another important local tool, because I have no time to convert it to py3 and cannot easily run it with py2, because it’s started with a custom runner.
<ArneBab>It’s never OK to push work onto maintainers — many useful tools have exactly zero maintainers.
<dokma>leoprikler: (kill (getpid) SIGINT) works! This is the only way to stop the server from the repl for now.
<dokma>Is this a clean shutdown though?
<leoprikler>dokma probably not, but you're one step closer to understanding what's going on, hopefully
<dokma>leoprikler: if I understand correctly accept is called with call-with-sigint so wouldn't SIGINT simply stop accept from waiting for a new connection?
<dokma>I'll try debugging to see if control returns to C++.
<leoprikler>it also kills the server socket
<leoprikler>but IIUC it doesn't flush existing connections
<dokma>leoprikler: the server socket is there just to accept new connections no?
<dokma>So it should be closed.
<dokma>If I do (kill (getpid) SIGINT) from the last active repl it seems to be a clean shutdown to me. Will do some tests.
<leoprikler>sure, but the server socket is the thing that doesn't get closed by you report
<dokma>leoprikler: it wasn't getting closed by calling (stop-server-and-clients!) or (close-port port).
***rt is now known as robin
<dokma>What does the arrow do on line 51 here:
<dokma>I've never seen this in Scheme. But I've been learning Scheme for only the past week.
<dokma>Here's a permalink to the line itself:
<dokma>leoprikler: are you still here?
<leoprikler>oh, this is a variant of cond that takes whatever the condition evaluates to (unless it's #f) and passes it on to a procedure
<ft>Yeah, the right hand side of the arrow must evaluate to a procedure and the result of the test is passed to it and the result of that application is the result of the cond.
<ft>The same thing exists for case.
<dokma>I've never seen it. Is that some recent addition or?
<dokma>Is that arrow some special syntactic sugar or just a symbol that gets passed to cond?
<ft>I'm pretty sure it's been in Guile for a while. Not sure if it's part of the standard.
<dokma>Thanks a bunch guys. You're really helping me out.
<ft>It's in r7rs, and I bet in previous versions too.
<dokma>But I supposed that => is nothing special syntax wise? Just a symbol the goes into cond ?
<dokma>*that goes*
<leoprikler>=> is syntax-boudn
<dokma>leoprikler: it's a special token?
<leoprikler>meaning it has a special meaning and can't be used as a symbol in that context
<leoprikler>similar to _
<dokma>leoprikler: outside of that context?
<ft>It's in r5rs too, at least for cond. Can't see it in case's description in it. But I just skimmed the document.
<leoprikler>(define => >=)
<leoprikler>works fine ^^
<dokma>So it's not some special token recognized everywhere. Just in cond
<leoprikler>not just in cond
<leoprikler>but in the context of cond it's a special token
<dokma>I see
<ft>Like else. :)
<dokma>leoprikler, ft: well if what you guys told me is true and if I understand stop-server-and-clients! correctly it will never close the server socket because it closes a socket only if there is a pair of them. Since the server-socket is the first one added, it will never be closed by this function?
<leoprikler>pair? is true for lists
<dokma>but it closes the cdr
<leoprikler>and the procedure is called recursively
<dokma>ooops no, closes the car
<leoprikler>so it should continue until the list is empty
<dokma>server-socket should actually be the first one to get closed
<dokma>actually last
<dokma>(cons s *open-sockets*)
<dokma>pushes new sockets to the front of the list
<dokma>So I can't figure out why (kill (getpid) SIGINT) shuts the server down but stop-server-and-clients! doesn't.
<dokma>After (stop-server-and-clients!) from the repl the server-socket is still opened and I can connect back in.
<dokma>*still open*
<leoprikler>which is why I hypothesize, that stop-server-and-clients! erroneously exits early
<vijaymarupudi>dokma, just curious, what are you working on?
<daviid>vijaymarupudi: did you see my yesterday's msg, i pushed a fix ...
<vijaymarupudi>daviid: I did, thank you! I responded but it looks like IRC bugged out.
<daviid>ok great
<vijaymarupudi>Here were my responses:
<vijaymarupudi>Basically, I can't seem to figure out how to get and use TreePath
<daviid>you need to set-cursor ... see the gtk manual .. for cursor i mean
<vijaymarupudi>Shouldn't I be able to get it from the TreeView though?
<daviid>vijaymarupudi: GtkTreePath is an opaque struct, not an object
<vijaymarupudi>Ah I see, I didn't know that
<vijaymarupudi>How would I get the values from this function?
<vijaymarupudi>It seems to return false no matter what I do
<vijaymarupudi>Even after click something in the TreeView
<vijaymarupudi>Here's a snippet to experiment on:
<daviid>you need to set-cursor, so that get-cursor returns, right in that descrption you pasted ... try to ask for help or example on #gtk maybe?
<daviid>going afk, bbl ...
<vijaymarupudi>This might be a misconception on my part, will get back to you
<vijaymarupudi>daviid: I think this might be a bug, here's a fairly equivalent Python program. If you observe stdout, you can see that it prints the TreePath and focus_column to stdout, but the g-golf version always prints false.
<vijaymarupudi>Make sure you click on some of the treeview entries to see the events happen
<chrislck>any looping gurus? in a hierarchical tree, i want to collect all descendants. anyone knows how to refactor to eliminate set! ???
<chrislck>hmm I think there's a nested fold in here
<RhodiumToad>use a tree fold?
<stis>tja guilers!
<manumanumanu>tja Stis!
<manumanumanu>I passed you dragon-infested home region just hours ago
<manumanumanu>chrislck: I would use the colloquial "good" flatten (which is a tree fold)
<manumanumanu>I have it somewhere
<manumanumanu>the downside is that it works on improper lists
<manumanumanu>which happens to be what you shold use instead of all the ugly flatten versions out there using append.
<manumanumanu>chrislck: and of course I didn't read longer than my own nose. You solved it yourself :)
<leoprikler>but, but append :(
<manumanumanu>go search for "flattening a list in scheme" and all solutions you find will use append.
<manumanumanu>sad times.
<daviid>sneek: later tell vijaymarupudi ok, will look into the problem and let you know ...
<sneek>Got it.
<daviid>sneek: later tell vijaymarupudi both paste you posted 'privetely' expired (but no problem, i know what/where to look at the problem,tx) -
<sneek>Got it.
<leoprikler>for the record, i think your version might not do proper tail recursion
<leoprikler>(foldts (const '()) (lambda (s0 s1 t) (append s1 s0)) xcons <list>) should only have call depth tree depth + 1, IIUC fold correctly
<daviid>fwiw, here is 'mine' :) -
<leoprikler>that looks the same but with match
<manumanumanu>daviid: well, you wrote that after I sent you mine and gave you the permission to do whatever you wanted with it, iirc :)
<manumanumanu>leoprikler: which for guile means faster, since no reverse at the end.
<manumanumanu>the largest problem with it is that it accepts improper lists without complaint
<manumanumanu>that is how guile's map works, iirc. And chez's as well
<manumanumanu>and racket's I suppose
<leoprikler>map* at least, from oop goops
<manumanumanu>not the improper list part, but the "right fold".
<leoprikler>idk if Guile's map is a right fold, it's probably implemented in C and I don't have the C code here atm
<manumanumanu>it is not
<manumanumanu>It is in boot-9
<manumanumanu>yup. I had a look at it recently when fixing vector-map/for-each in the r6rs module
<leoprikler>ahh, my search string was wrong
<manumanumanu>And I'm pretty sure (as in: I know) that it is a right fold.
<manumanumanu>in C it could not be, of course, since it would stack overflow unless you start doing voodoo.
<leoprikler>yep, it is
<manumanumanu>there is a much nicer version of map in the r6rs module. The boot-9 version relies on (length ...) to check that the list is proper.
<daviid>manumanumanu: yes :) i quoted 'mine' because while pasting now, i didn't remember who helped me at the time, butichecked and i did thank you in the commit msg 537e8cc12fe2f3095f065084ea2b9376d548b6e6 - i pasted because you said 'all scheme versions 'out there' use append' ... but it's all yours :)
<manumanumanu>now it's yours!
<manumanumanu>everyone can have it :)
<daviid>manumanumanu: yeah,but i like to thank who helpsmeinmy logs ... sorry i didn't mention your name here 'now' ...
<manumanumanu>I would like to be the kind of guy that just lets that slip :(
<manumanumanu>It is a moral obligation to be the best you can be, and I lapse constantly :D :D
<manumanumanu>I like to read other people's "collected stuff that might be good to have".
<vijaymarupudi>daviid: My pastebin links seem to still be working for me, do they not work for you?
<sneek>vijaymarupudi, you have 2 messages!
<sneek>vijaymarupudi, daviid says: ok, will look into the problem and let you know ...
<sneek>vijaymarupudi, daviid says: both paste you posted 'privetely' expired (but no problem, i know what/where to look at the problem,tx) -
<vijaymarupudi>Thanks sneek