IRC channel logs
2023-12-23.log
back to list of logs
<chitochi>i think it's dthompson? afk right now i think :/ <guileHacker4000>I understand, thank you. I've sent them a message on mastodon, I hope they'll see it. <apteryx>does scm_internal_catch return either the result of the body, else the result of the handler, if an exception was handled?, the same as in Scheme? <euouae>yes, exceptions with 'tag' are caught <apteryx>what does scm_throw do in C, considering there are no exceptions in C ? <apteryx>phew, I think I'm done figuring out how to replace select with scm_select in guile-udev <euouae>apteryx: this one might not be documented very well <euouae>I don't think it's thread safe? there is a static throw_var that keeps the state <euouae>no wait, throw_var is the closure called with (key . args). <euouae>and later it is initialized with scm_c_define("throw", ...) <euouae>so I'm actually confused about this part, but I figured I'd explain a bit more by looking at the sources. <apteryx>I thought SCM_NEWSMOB was obsoleted by scm_new_smob reading NEWS, but I'm not sure what I'm doing <euouae>something isn't right there apteryx <euouae>the guile reference I have says the signature takes a void* as second parameter <euouae>but your compiler claims it's an scm_t_bits <euouae>see if the latest version of guile documentation + libguile.h headers makes sense: the signatures should agree (on docs and on the header). If not, it's a bug <euouae>or wait, the description says: " The initial values data, data2, and data3 are of type scm_t_bits; when you want to use them for SCM values, these values need to be converted to a scm_t_bits first by using SCM_UNPACK. " <euouae>so I think you need to use return scm_new_smob(udev_hwdb_tag, SCM_UNPACK(uhd)); <apteryx>my reference manual (built from source) does say: C Function: SCM scm_new_smob (scm_t_bits tag, void *data) <apteryx>the value used as data is a struct, not SCM though <dsmith>apteryx, It's from 10 years ago... <dsmith>#define SCM_NEWSMOB(z, tc, data) \ <dsmith> z = scm_new_smob ((tc), (scm_t_bits)(data)) <apteryx>NEWS suggest it may be deprecated by scm_new_smob in time <apteryx>ah! is SCM_NEWSMOB defined to do the necessary cast itself? <apteryx>I guess that NEWS entry is bogus; that macro seems useful <tomnor>When recurring like the little schemer, (consing a car to a recursion), is there a limit? <tomnor>I mean, on the number of "loops" <apoorv569>Hi, I'm new to lisp languages in general. Recently been using guix and learning guile scheme along side. <apoorv569>I am writing my shell scripts in guile scheme to practice. <optimal>tomnor: I haven't read the little schemer, but Guile does have tail call elimination, where recursion in the form of tail calls is optimized so it doesn't "blow the stack". <apoorv569>I'm curious if it possible to have colored output from shell scripts? <apoorv569>Like from the `(display` procedure for example. <tomnor>I have just observed that even if a call is not tail recursive, like (cons something (recur something)). <tomnor>I run that thousands of loop and no crash <optimal>apoorv569: You can install guile-lib with guix via: `guix package -i guile-lib`' <optimal>tomnor: The expression you describe is tail-recrusive <tomnor>not to my understanding, the last call is cons <apoorv569>optimal: I see. Thanks for the recommendation. <optimal>tomnor: The last call is `recur', no? <tomnor>Maybe my example is poor, but it is an argument to cons, therefore evaluated before the cons is called <optimal>I may be wrong, but if the last expression is a call to the current procedure (recursion), I believe that suffices for tail call optimizaiton, but I'm not sure. <tomnor>One can observe the difference using ,trace <tomnor>optimal: maybe, maybe not. check it out, its very interesting to see the trace like that <tomnor>I seem inclined now to use name lets everywhere to make proper tail recursion <apoorv569>I noticed that I can't seem to `CTRL + C` cancel out of certain commands I run via the guile script. <Arsen>ah, welcome to the job control jungle <Arsen>that happens because of some weird interaction between TTYs and programs ran in them that I don't fully grasp <Arsen>IIRC the TLDP manpage credentials(7) covers this topic <Arsen>unfortunately, I don't know of good documentation in a good format on this topic <tomnor>apoorv569: what about ctrl + d ?