IRC channel logs

2021-06-17.log

back to list of logs

<dsmith>ninety-nine guilers are here in the chan
<dsmith>ninety-nine guilers are here..
<dsmith>if one of those guilers should happen to /part
<dsmith>ninety-eight guilers are here in the chan
<apteryx>hello! is there a way to programatically retrieve the source code of a procedure?
<RhodiumToad>in theory there's procedure-source, but I don't see it returning anything other than #f
<manumanumanu>apteryx: you could define it yourself, if it is supposed to be used in a system where you don't need to retrieve source of built-ins
<manumanumanu>either using applicable structs where you store the source and the lambda (and some identifier-syntax trickery to make recursive calls fast), or by some hash-table thingie (probably less robust. proceduce equality is a bit weird due to... eh... beta-reduction??)
<apteryx>RhodiumToad: eh, that's my experience with procedure-source as well
<RhodiumToad>manumanumanu: I think you can just explicitly set the source property on a procedure, too
<manumanumanu>even better! :)
<apteryx>manumanumanu: thanks for the hints
<RhodiumToad>(set-procedure-property! foo 'source whatever) makes a subsequent (procedure-source foo) return whatever
<RhodiumToad>at least by default the compiler doesn't seem to set that, I don't know if there's maybe a knob for it
<manumanumanu>apteryx: if you want to, you could define a module that redefines define to do what RhodiumToad suggests. That would be the best solution.
<daviid>i've pushed a few important patches to g-golf, overriding some gdk-4 clipboard related functions (methods) and added a clipboard.scm gtk-4 example, to the devel branch - pretty cool the clipboard example ... :)
<civodul>hmm, can't #:re-export srfi-1 'delete' without getting "overrides core binding" warnings at run time
<RhodiumToad>shouldn't that be a #:re-export-and-replace ?
<civodul>ah ha, true!
<civodul>lemme check
<civodul>i had forgotten about that one, thanks RhodiumToad!
<civodul>i was close to being creative and use something other than 'delete' as a syntactic keyword for my macro :-)
<taw10>manumanumanu: An 'applicable struct' solves a similar problem for me, but I could never find any documentation on how to create them. Do you have any pointers?
<leoprikler>In GOOPS you can inherit <procedure>, dunno about C
<taw10>leoprikler: Thanks. But when creating a new "<myprocedure>", where does the procedure body go?
<civodul>taw10: i don't think applicable structs are documented, but see <parameter> in boot-9.scm
<dsmith-work>Morning Greetings, Guilers
<Zelphir>Hello dsmith
<tohoyn>hello
<manumanumanu>taw10: you have to use the low level interface. an example: https://github.com/lloda/guile-newra/blob/ee633920bd779463e43510ed07db17ce296eb85d/mod/newra/base.scm#L179
<taw10>civodul, manumanumanu: Interesting, thanks!
<RhodiumToad>taw10: in goops, you can inherit <applicable-struct> or <applicable-struct-with-setter>
***KindOne_ is now known as KindOne
<stis>heya guilers!
<civodul>by any chance, does someone have a reader and/or pretty-printer that can deal with comments?
<wingo>civodul: what do you mean? which returns comments in the result?
<civodul>wingo: yes
<civodul>apparently Racket has "special comment" values: https://docs.racket-lang.org/reference/Reading.html
<wingo>i don't have one but it should be reasonable to build from read.scm
<civodul>yes, i guess so
<civodul>i was looking for a quick'n'dirty way to hack something atop 'read'
<civodul>but it's probably safer to just hack 'read' directly
<civodul>s/probably/undoubtedly/ :-)
<dsmith-work>civodul: No Comment
<civodul>:-)
*wingo has an ,optimize-cps repl command, that prints in a standard-ish form kinda like llvm ir
<civodul>wingo: oh, that can be handy!