IRC channel logs

2020-11-01.log

back to list of logs

<maketo>hello! I have been tinkering with scheme for a while now (as a hobby) - was wondering how people progress to a higher level. Book recommendations? Code to read? Thanks!
<maketo>(have worked through "the little schemer" and about to move on to "seasoned schemer")
<mwette>maketo: maybe look into macos, like Chap 3 & 8 of https://www.scheme.com/tspl4/; if that suits you check out .../share/guile/X.Y/system/base/pmatch.scm
<mwette>pmatch is somewhat similar to (ice-9 match), which is documented in the Guile Manual, but is simpler; it shows how to write CPS macros
*chrislck_ wonder what the name kanren stands for
***chrislck_ is now known as chrislck
<RhodiumToad>apparently japanese for "relation", "to be related to"
<RhodiumToad> https://en.wiktionary.org/wiki/%E9%96%A2%E9%80%A3#Japanese
<chrislck>Kanren code looks so foreign :(
***catonano_ is now known as catonano
<maketo>@mwette: thanks :)
***jonsger1 is now known as jonsger
<lampilelo>leoprikler: a dangling pointer to data pointed by the bytevector already bit me in the ass, i made a function and then proceeded to use it not as i intended, took me a day to do it, lol
<prussian_blue>evening folks
<prussian_blue>how do I take a c function and create a lambda from it, applying it's first argument? (i.e. such that it can be called from guile with zero arguments later on)
<seepel>prussian_blue: I think it depends on whether you want to do it from the c side, or the guile side. I think the relevant section of the manual is here: https://www.gnu.org/software/guile/manual/html_node/Foreign-Function-Interface.html
<prussian_blue>the full story is, I have a c program, I want to take user input and evaluate it as guile code
<prussian_blue>but, I want to catch exceptions that occur, so my main thread doesn't get aborted
<prussian_blue>in order to catch exceptions, I need a handler function
<prussian_blue>but I at least need a userdata pointer to make this practical, or something
<seepel>Hmmm, I've mostly only dabbled in the FFI, so others folks probably know more. Have you seen this section (https://www.gnu.org/software/guile/manual/html_node/Extending-Dia.html#Extending-Dia) about extending a c application with guile? It may be more applicable to your situation.
<prussian_blue>I have read that part of the manual (and indeed everywhere else) but it doesn't mention any error handling
<prussian_blue>there is a section on the old style of error handling in C
<mwette>lookup scm_catch
<prussian_blue>right, I've found scm_catch, but in order to write a reasonable handler, I need to be able to partially apply it before sending it to scm_eval
<prussian_blue>*scm_catch
<prussian_blue>the problem is that there seems to be nowhere to provide userdata or anything like that, in any of the guile api functions
<mwette>I'm guessing you will need to have inputs and output from scm_eval as globals and define your thunk and handler.
<prussian_blue>that's a little disappointing
<prussian_blue>needing to use globals, I mean.
<mwette>Yes. C function scope is limited.
<mwette>Just looked. Gcc does provide nested functions.
<prussian_blue>but I would have thought that guile would provide an API where some userdata can be associated with a function?
<seepel>I would think you could create a guile module that loads the user code, and call the module's exported functions from c providing the necessary data. It would also give you a convenient place to wrap everything using with-exception-handler.
<prussian_blue>hmm yeah
<prussian_blue>a shim module wouldn't be a bad idea
<prussian_blue>thanks folks, :D bedtime for me now
<seepel>good night, and good luck!
<matijja>Hello Guilers!
<matijja>Why is this not working as expected? http://paste.debian.net/hidden/08a39ef5/
<leoprikler>matijja: Because this behaviour was changed between Guile 2.2 and 3.0. I believe the rationale was that changing this so that classes couldn't be overwritten willy-nilly allowed for some optimizations.
<leoprikler>See `info '(guile)Redefinable Classes'`
<johnjay>question. why doesn't gimp use guile instead of tinyscheme?
<johnjay>is there some incompatibility between the different scheme versions?
<leoprikler>Probably historical reasons. I don't know what would happen if you were to pitch Guile to them.
<matijja>leoprikler: Thanks.
***catonano_ is now known as catonano
<rekado>civodul: congratulations on releasing Skribilo 0.9.5!
<civodul>rekado: heh thanks :-)
<civodul>mostly a long-overdue update to Guile 3
<civodul>but i must say also i envy Scribble!
<civodul>would be interesting to explore Guile Studio integration