IRC channel logs

2021-07-29.log

back to list of logs

<jgart>How would someone describe in their own words what call-with-deferred-observers does? It is used in the macro expansion of define-public: https://paste.sr.ht/~jgart/d7cf527b42dcef4d5bd72c2b4c3a1b899c7bf934
<tohoyn>daviid: here is a snipset to reproduce GTK warnings: https://paste.debian.net/1205919/
<sneek>tohoyn, you have 1 message!
<sneek>tohoyn, daviid says: these are Gtk-Warnings, i'd be happy to try to help, but as usual, i need a code snipset to reproduce ... you may also ask on #gtk using irc.gnome.org
<daviid>tohoyn: no warnings here
***KM4MBG is now known as jackhill
<tohoyn>daviid: ok
<tohoyn>daviid: what criteria should be fulfilled to make an alpha release of G-Golf in debian?
<stis>tja guilers!
<daviid>tohoyn: in debian i don't know, but upstream, the 'Using G-Golf' must be complete, and more examples, iamworking on both ...
<avp>Hello Guilers! Is there a way to serialize a lambda to a file?
<avp>I need to generate a code with a reference to a user procedure. If the procedure is defined in some module, I can simply print its name and resolve it from the module when the code is read from a file. But if the procedure is anonymous, then I need a way to store it as well, ideally as the same lambda as it was in the source code.
<leoprikler>avp not always, but `procedure-source' might give you what you're looking for
<avp>leoprikler: Thanks, I checked this procedure before asking my question, but the source is not always available; in my tests it returned #f for all cases.
<leoprikler>yeah, it's not always defined
<tohoyn>avp: would it be easier to use the Tree-IL source of the procedure?
<avp>It's possible to set procedure source by means "(set-procedure-property! a-procedure 'source '(lambda ...))"
<avp>I looked into the souce code of "libguile/procprop.c" and basically 'procedure-source' tries to get a procedure property named 'source'.
<avp>tohoyn: Interesting idea. So I compiled a lambda to Tree-IL, how do I call that?
<tohoyn>avp: should it be compiled to guile bytecode and load it with load-compiled?
<tohoyn>daviid: about the gtk warnings, it's not a g-golf bug. evince gives similar warnings for me.
<tohoyn>avp: are you using the user procedures from guile or C?
<avp>sneek: later tell tohoyn I'm using user procedures from Guile (Scheme).
<sneek>Okay.
<avp>sneek: botsnack
<sneek>:)
<RhodiumToad>avp: how would you deal with bindings, though?
<avp>That's a good point. But I think the procedure can get its bindings from the same modules as when it was evaluated first time, because the same set of modules will be present.
<avp>I'm writing a state-machine compiler and there's a concept called "event-source" which is a procedure that a FSM must call to get the next event to handle: https://github.com/artyom-poptsov/guile-smc/blob/2de074986548655d81e398ac1a5b0acbe081c110/modules/smc/fsm.scm#L110
<RhodiumToad>lambda captures local lexical bindings, which you're not going to be able to get from any module
<avp>But if we can somehow translate a lambda into its source form and then store it as a piece of data (a list), we can read and evaluate it again.
<avp>Am I right?
<leoprikler>sure, but without context
<avp>And then new lambda capture whatever it has around at the time of the evaluation.
<RhodiumToad>no, that wouldn't work
<avp>Maybe I should require that a procedure always must be written in a module so I can avoid this problem altogether.
<RhodiumToad>why are you trying to serialize the procedure?
<RhodiumToad>it looks like event-source is something that is only relevant at run time
<avp>RhodiumToad: The thing is that I have a state machine that produced another state machine.
<avp>There's a parser for PlantUML format that reads a state machine description and turns it into a working state machine in memory; and then you can take that new state machine and compile it to a Scheme code so you don't have to parse PlantUML again to get this state machine.
<RhodiumToad>ok, but what about that requires serializing the event-source?
<avp>RhodiumToad: Hmm, it seems that the problem arises ony when a user writes a FSM by hand as the event source can be specified as a procedure from a module or a lambda. If I require that when a FSM is generated the event source must always be a procedure from a module, the problem dissapears.
<avp>s/ony/only/
<avp>I think I figured out how to solve that problem, more or less. Thanks everybody for help.
<roptat>leoprikler, what's a pseudo-stream?
<leoprikler>anything that behaves like an SRFI forgot the number stream
<leoprikler>dunno the most efficient implementation of it
<roptat>one of the issues I have is that I need to sort the list and then process it
<dsmith-work>Thursday Greetings, Guilers
<roptat>the processing now takes more time than reading the file, although it still takes 2 minutes to read a 52MB file
<roptat>well, maybe I can't go below that too much, there are 100 000 entries, so that's roughly 1ms per entry
<avp>Guilers, is there an "official" implementaton of "set" data structure for Guile? (And same question for "stack".)
<RhodiumToad>srfi-1 has list-based sets, or you can use a hashtable
<RhodiumToad>(list-based sets don't perform very well for obvious reasons)
<avp>RhodiumToad: Thanks.
<RhodiumToad>stacks are often done by just consing
<avp>Having a good abstraction would be nice though.
<RhodiumToad>i.e. push by consing on the front of a list, pop by taking the cdr
<avp>Yeah.
<RhodiumToad>couple of simple macros would handle abstracting it
<leoprikler>push/pop is queue tho
<leoprikler>or stack, yeah
<avp>I used GOOPS to implement a mutable stack and a set.
<avp>Not very pleasant from the functional perspective indeed. But works. ;-)
<leoprikler>you could do it like the cool kids and use trees
<leoprikler>(for your sets)
<avp>leoprikler: Thanks, I'll try to boost my functional coolness later, when I solve more important issues in my project. ;-)
<vijaymarupudi>daviid: a question about g-golf, I was curious why g-golf's startup time is significantly longer than pygobject-introspection, do they do something at compile time that g-golf does in runtime?
<chrislck>ooh craftinginterpreters.com mentions Guile...