IRC channel logs
2021-08-22.log
back to list of logs
<dokma>Ok, first success in debugging the run-server and stop-server-and-clients! issue. When I (reverse *open-sockets*) inside stop-server-and-clients! everything shuts down correctly. <dokma>But even with reverse it seems like not all sockets are closed cleanly. At least I don't get the debug output for all of them. <dokma>Although sockets are getting closed during shutdown so it might be normal. <dokma>It seems that something gets bogged down during the closing of the socket through which the stop-server-and-clients! is called in the case when I do not call (reverse *open-sockets*) and then, obviously, since the server-socket is the last one it does not get closed. <dokma>There's obviously some bug there but my guile version is 2.2... <leoprikler>So, how about some server-side printf debugging? <stis>If only I could make an app to get some money to support guile development ... <stis>and for a tesla S plaind <stis>lol but not needed tohough and I probably end up bying an electric bike. <Zelphir>Writing some Guile code at this moment, but got my continuation wrong and the list I return is reversed. But too stubborn to post the code. Want to solve this one myself. <stis>Zelphir: cool, yes the order in produced list is a bit tricky in scheme <Zelphir>I know, that I have gotten this kind of stuff right before, at the very least when going through the little schemer, where it leads to "the tenth commandment". I must have a silly thinking mistake here somewhere ^^' <stis>tonight I will add hasmaps to my serialiser (strings are superfast ). This is tricky becasue it is not possible to know which kind of hashmap it is.... <stis>else it is as simple as saving the ke value pairs and construct then add the k-v list to the hashmap <stis>if I can get holds of the keys used for the hashmap it is possible to find out if eq eqv or equal hash values are used, whihcis my plan <stis>get hold of the hash values of the keys used <Zelphir>Converting to alist does not help, does it? I mean, you would still have to figure out how the keys must have been compared to give that set of keys, I guess. <stis>no because you need to know ig hashq-set, hash-set or hashv-set has been used when you recreate the hashmap else you are right <stis>I will need to do som e nasty C hack <stis>that will brake in the next guile release (lol) <stis>another possibiliity is to allow just one kind of hashmap <stis>a third is to use object-properties and need people to mark the hashmaps <Zelphir>Or perhaps wrap existing hash-tables in some kind of struct, that contains the information you need. And you could have some (hash-table->serializable-hash-table ...) where one needs to specify what the comparison function is. <Zelphir>It might hinge on being able to serialize lambdas. If one specifies a custom `equal?`, then that might need to be serialized as well. <stis>yep, but its a significant overhead for e.g. python objects (which are hasmaps) but this works in many other cirbumstanses. Anuhow I have a c-stub taht detects if its 1/eq 2/eqv /3equal 4/other <stis>if we assume a assoc in the bins <stis>actually we will detect if it' not an assoc and punrt with 4 in that case <stis>that should cover all cases <stis>Zelphir: custom hashes will need to use custom serilaizers. just as you describes with embedding them in a struct <stis>I could paste the code here if you like if I only know how to link to a paste <Zelphir>Not sure I will understand much of it ^^ and I still have not found the mistake in my own code. <Zelphir>This whole thing with serializing lambdas is something, that seems to come up again and again in various Scheme dialects and also in Racket. I have seen it "just working" in Erlang and I wonder, whether there is any trick, that they used in Erlang to make it work, which could be copied to the Scheme world. I remember simply sending lambdas to other processes from the REPL and not having to do anything special, besides sending a message to an actor's <stis>well a closure is a list of variables and and address of the code. Ideally we sould have support for this but it is nota available yet in the scheme land. But with some c magic you can make it work <stis>also deserializing lamdas comming from the internet is not the smartest thing you can do so some way of restricting the lambdas is needed <stis>Note that the address of the lambda needs to be relative go files so it will brake if you have tow schemes with different go layout <Zelphir>C is scary for me. :D I did use some C at university, but thinking back and remembering all the segfaults I had, until I had a solver for linear system of equations using the triangular form of a matrix ... It took many hours of debugging and printing values. Well, I guess that is normal, if you have not done much C before. <stis>yes printf is may main tool, biut also gdb sometimes is nice. I is a big cannot to shoot yourself in the foot though <Zelphir>I have not learned yet, how to properly use GDB, even though perhaps I should learn it at some point. <stis>Actually I would like guile to support binary serializing and deserializing as it depends on internals of the datastructures to a large degree in order to get efficiency and correctness <stis>that can be extended very much like python <Zelphir>Ah btw., for your Python on Guile, did you look at the Python grammar and implement that as a PEG grammar or something like that? <stis>Zelphir: grap a tutorial, I just use it for backtraces mainly and that's super simple <Zelphir>That's what is so great about actually having a grammar. People can parse your stuff and have a data structure representing it in whatever other language they choose. <Zelphir>You have your own PEG tool? Does it do more than the ice-9 peg tool? <stis>and PEG is sooo nice or is it called parser combinators, donough, I use it to implement the re module as well whihc is dog slow <stis>you build the parser through functions or combinators <Zelphir>I have recently used the ice-9 peg tool / lib to parse a game's file, which was not a standardized format. (Actually it is quite a mess of a format.) There were a few gotchas with using PEG and sometimes not understanding why something was not parsed, when I thought it would parse. Ultimately I figured it all out. <Zelphir>And writing tests for testing what would parse was a life saver <stis>yep this is the issues with the tool path, debugging, I intriduce printouts to trace the parser via a printout combinator, works like a charm <Zelphir>Ah, that's why you build your own. I see! <stis>No it was just to have fun actually! its not especially fast, but then the compiling takes longer so I don't bother <stis>It is an example of a prolog environment <stis>it actually have a expresson parser generator so that you can create new operators omn the fly just like in prolog <Zelphir>Prolog -> Reminds me, I still have not gotten through all of the minikanren uncourse videos. One of the many things of my loooong backlog ^^' Haven't done much Prolog, except for exercises like "Sort a list in Prolog!", so I am not so knowledgeable about it. Only know the basic working principle. <stis>kanren/prolog is sooo fun, used it a ton, the Triskas clpfd module is golden <stis>you have it in swiprolog and it used to work on guile on my prolog engine <stis>that module takes 15minutes to compile <Zelphir>(Triskas? What is that?) I found it mind blowing, when minikanren was explained at one of the RacketCons and they showed how they used it to generate programs (well, little functions). <Zelphir>"Constraint Logic Programming over Finite Domains" - uh hu <stis>I would love to port that to minikanren <Zelphir>I remember at university we had one homework with Prolog, which was to solve the zebra puzzle (https://en.wikipedia.org/wiki/Zebra_Puzzle). There was one cheap solution and one good solution. The cheap solution involved somehow already defining lists of many `_` and the good solution involved actually specifying relationships and so on properly in the knowledge base. <stis>yeah there are som reallly cool applications of minikanren <stis>yes the zebra is a classic <stis>but there is so much more to explore in prolog and minikanren <stis>very good mental exersizes <stis>the soduku solver in that link has never failed to deliver an answer with less then a second for essentially all hard soduku examples I tried <Zelphir>There, solved my issue with the continuation, by avoiding continuations completely and simply going backwards through a vector from last to first element, which results in a "first to last" list of indices, which I needed. <Zelphir>A bit sad, that I did not get the continuation version right, but in the end, why use continuation, if there is a simpler way, which does not build up a nested lambda, which will create the list at the end, and can simply use plain cons instead? So I decided to not use continuation. <Zelphir>Sodoku solver is a great learning project, I think. <Zelphir>I think parser-combinators is a bottom up approach (?) and PEG is top down. <Zelphir>But not sure whether I am using the terminology correctly. <stis>not sure either, im not an expert when it coms to the definition of these <stis>whatching tesla ai day, this blows my mind <Zelphir>First time I read about parser combinators was on amirouche's old blog. I also found a paper, where they used something similar to Haskell, I think Gopher or something, and introduced the basic combinators, from which one could build anything. I tried to implement same in Scheme, but must have introduced a mistake somewhere. The order of application of the lang used in the paper did confuse me and I needed a long time to understand what each <Zelphir>vector of correct length and copies over the values at the indices from the source vector to the new vector. <stis>looks good, no need for conts