IRC channel logs

2021-02-22.log

back to list of logs

***wxie1 is now known as wxie
***karlosz_ is now known as karlosz
***apteryx is now known as Guest22097
***apteryx_ is now known as apteryx
***hugh_marera64 is now known as hugh_marera
<soda__hobart>hi guileful ones, i'm trying to figure out how to use these guile procedures as callbacks in a C++ program
<soda__hobart>i tried this: SCM proc = scm_c_eval_string("(match-lambda ( ((1 . a) _n+1 ooo) a ))");
<soda__hobart>but it seems to evaluate the procedure right then and there (presumably with nil as the argument)
<soda__hobart>what i need is a pointer to that procedure so i can call it later
<spk121>soda__hobart: well there are lots of ways. But if you want something like scm_c_eval_string, you could do SCM proc = scm_c_eval_string("(lambda () match.....
<soda__hobart>i did that too! same thing
<spk121>and later call proc with one of the scm_call_1 family of procedures
<soda__hobart>like i did: scm_c_eval_string ("(lambda (x) (match x ( ((1 . a) _n+1 ooo) a )))");
<soda__hobart>and it did the same thing as before, evaluated it right away
<soda__hobart>do i need to use scm_procedure_to_pointer ?
<spk121>I think scm_procedure_to_pointer is probably not the way to go
<soda__hobart>i know that eventually i'm going to be using a file as input and compiling the procedures from that, but for right now i'm just trying to hardcode it in as strings to test out how it works with the inputs
<soda__hobart>i could have sworn that i did this before and it worked as expected, so i wonder if it has something to do with how i'm calling scm_boot_guile and scm_init_guile
<spk121>something like this, perhaps... https://paste.gnome.org/pvepnm2hq
<soda__hobart>hmm, yeah, i can get something like that to work, but i'm trying to be able to add them at runtime
<soda__hobart>so you can use the api and be like add-event-handler (lambda (x) blah blah...)
<spk121>pretty sure it works at runtime. In this example, the proc is defined and evaluated at runttime https://paste.gnome.org/pifbspfbr
<spk121>anyway, good luck!
<soda__hobart>thanks! i will get it working eventually, but before i can work on it i have to do some "real work" :(