IRC channel logs

2021-05-28.log

back to list of logs

<linas>So running ChanServ on this channel is intentional? Because when I try to msg chanserv, all the responses come back here, mo matter where I started...
<linas>anyway, hello libera-world
<linas>and a few exclamation marks of approval drama!!
<RhodiumToad>that's probably something weird about your client
<RhodiumToad>chanserv is here because (for whatever reason) the GUARD option is set on the channel
<linas>OK, thanks! the drama of onboarding...
<emanuele6>wingo: I just found out libera.chat hosts an instance of kiwiirc at https://web.libera.chat/
***micro is now known as micro_
***micro_ is now known as _micro
***_micro is now known as rprimus
***rprimus is now known as rprimus_
***rprimus_ is now known as _rprimus
***_rprimus is now known as golgotha
***golgotha is now known as micro
<RhodiumToad>that's new, I think
<wingo>emanuele6: neat!
<emanuele6>yeah, I think it's new
***rekado_ is now known as rekado
<tohoyn>new version Theme-D-Golf 0.9.2 has been released. see http://www.iki.fi/tohoyn/theme-d-golf/
<leoprikler>Is it difficult to generate Theme D bindings from scheme or is it rather straightforward?
<tohoyn>leoprikler: you mean accessing guile procedures from Theme-D code?
<leoprikler>yup, more or less
<tohoyn>leoprikler: it's easy.
<tohoyn>leoprikler: here is the definitioj of Theme-D procedure d-car that is implemented by guile procedure car: (define d-car (unchecked-prim-proc d-car (<object>) <object> pure))
<tohoyn>leoprikler: the first <object> is the argument type
<tohoyn>leoprikler: the second <object> is the result type
<leoprikler>and pure vs. nonpure is whether they change state
<tohoyn>leoprikler: "pure" means that the procedure has no side effects
<tohoyn>leoprikler: yes
<leoprikler>can it deal with arbitrary arities?
<leoprikler>e.g. format
<tohoyn>leoprikler: yes
<tohoyn>leoprikler: here is an example: (define string
<tohoyn> (unchecked-prim-proc string ((rest <character>)) <string> pure))
<tohoyn>leoprikler: procedure string takes an arbitrary number of characters as arguments
<tohoyn>leoprikler: "unchecked" means that Theme-D compiler/linker does not generate code to check that the result value is of correct type.
<leoprikler>can it do (and (* (<keyword> <object>)) <string> (rest <object>))?
<leoprikler>or do I just have to write (rest <object>) and let it be caught at runtime?
<tohoyn>leoprikler: what are you trying to define?
<leoprikler>The return value of this baby: https://gitlab.com/leoprikler/tsukundere/-/blob/0.3.x/tsukundere/entities/person.scm#L76-90
<leoprikler>I guess <procedure> would be fine, but still
<tohoyn>what are the argument types and the desired result type of this procedure?
<leoprikler>the procedure gets an <entity> and returns a procedure
<leoprikler>Functional programming with side-effects :D
<tohoyn>leoprikler: you can define procedure types in Theme-D
<tohoyn>leoprikler: see https://paste.debian.net/1199199/ for an example
<tohoyn>leoprikler: procedure map1 applies the argument procedure to the argument list
<tohoyn>leoprikler: what are the argument and result types of the returned procedure? are they arbitrary?
<leoprikler>pseudo-arbitrary
<leoprikler>it's a keyword-value list followed by optional string + rest (rest is just a bool atm, but not important)
<tohoyn>leoprikler: (declare myproc (:procedure (<entity>) (:procedure ((rest <object>)) <object> nonpure)))
<tohoyn>leoprikler: it's ok if you pass the keyword-value list as one argument
<leoprikler>it's many args tho :P
<tohoyn>leoprikler: I'm afraid that can't be done
<leoprikler>okay, so I'll still have the work inside the match-lambda
<leoprikler>what's the difference between declare and (define d-car ...) btw?
<leoprikler>could I "use-modules" a guile module and then just put a bunch of declares and be done with it?
<tohoyn>declare declares a procedure and it is used mostly in interface files (each module has an interface and body)
<tohoyn>leoprikler: you have to tell the Theme-D linker to generate code to include your guile module in the Theme-D program
<tohoyn>leoprikler: then you have to put the declare's into the interface file and the correspoding define's into the body file
<leoprikler>speaking about linker, what does theme-d compile to?
<tohoyn>leoprikler: guile Scheme or Tree-IL
<leoprikler>is it theoretically possible to write a theme-d header for a scheme body?
<leoprikler>i.e. omitting the theme-d body?
<tohoyn>leoprikler: no, you have to define the procedures as "prim-proc" or "unchecked-prim-proc"
<tohoyn>leoprikler: but it would be quite easy to write a program to generate the body
<tohoyn>leoprikler: actually Theme-D-Golf resembles that
<tohoyn>leoprikler: the interface and body files are generated from a "Golf import" file
<tohoyn>leoprikler: then Theme-D-Golf has a third script that generated a guile module to be included (use-modules) in the target program
<tohoyn>^generates
<dsmith-work>Happy Friday, Guilers!!
<civodul>hey dsmith-work!
<civodul>happy Friday!
<chrislck>happy Friday, in this new home
*sneek dances
<apteryx>how do I return all the matches for a given regexp pattern in a string?
<civodul>apteryx: there's a fold-matches procedure
<apteryx>thanks! will read on it
<apteryx>oh, I see a list-matches too
<apteryx>neat
<apteryx>Would someone be able to tell why the following service fails with: Unbound variable: pattern ? Perhaps the and-let* syntax is somehow not made available? Otherwise I fail to see it. https://paste.debian.net/1199223/
<RhodiumToad>apteryx: I don't see anything that imports and-let* ?
<RhodiumToad>needs (srfi srfi-2), no?
<apteryx>oh! I thought I added that... but it's indeed missing. Let me regenerate that (it's created by a Guix G-Expression) to make sure. Thanks!
<apteryx>ah! I see my mistake; I added (srfi srfi-2) to the wrong service. eh. Sorry and thanks again for lending me your eyes :-)
<civodul>apteryx: i suggest avoiding srfi-2 in Guix :-)
<civodul>granted, it's a matter of taste
<RhodiumToad>why avoid it?
<civodul>RhodiumToad: like i said, it's a matter of state; i find i'm usually better off with 'match' and sometimes 'and=>'
<leoprikler>match and and=> work super if you have a common source, but are somewhat clunky if you're dealing with inputs coming from multiple places
<leoprikler>though in the specific case of Guix, that ought to be rare
<RhodiumToad>I've used it in cases that basically amount to: compute a value, check its range, compute a further value from it, check that
<RhodiumToad>(and then do something if everything was valid)
<apteryx>right, that makes sense to me, but perhaps it's more procedural in style than functional
<leoprikler>yup, Guix tries to be very functional indeed
<lispmacs[work]>hi, I am wanting to write a guile program to interact (RX and TX) with some firmware I have running on an Arduino board, through a ttyACM connection (UART over USB). i.e., to do stuff you would normally have to type into minicom. I was wondering if Guile has some kind of support for serial communications, or if I try piping things in and out of the modem program, or if there some better approach...
<lispmacs[work]>s/if I try/if I should try/
<RhodiumToad>bidirectional piping to a subprocess is very difficult to do cleanly without deadlocking
<RhodiumToad>it should be possible to handle the serial port directly from guile without too much difficulty
<lispmacs[work]>RhodiumToad: how do I handle the baud rate settings and such from Guile?
<RhodiumToad>hm, tcgetpgrp etc. are present, but not tcgetattr/tcsetattr
<RhodiumToad>seems an odd omission
<RhodiumToad>you could always spawn the stty command for that
<RhodiumToad>or use the FFI to call tcsetattr
<dsmith-work>For serial stuff in general (but it seems to be mostly usb serial these days), I like to use ser2net. Yeah, you must edit a config file.
<dsmith-work>I usuallly have different ports for different baud rates.
<dsmith-work>(ser2net maps a serial port to a socket)
<dsmith-work>And then I just telnet or nc to that port.
<dsmith-work>As a bonus (or sercurity hole) I can than get to get serial port from anywhere in the network.
<dsmith-work>s/get to get/get to that/
<dsmith-work>I used that almost daily to talk to linux serial consoles or other embedded devices with a uart.