IRC channel logs

2018-04-24.log

back to list of logs

***longshi is now known as enso
***Raimondii is now known as Raimondi
***Raimondii is now known as Raimondi
<niebie>hi #guile - i've been playing around with calling guile from c and have a question about it.
<niebie>i've got some records defined using srfi-9, and want to call the getters from c
<niebie>when i try and call them directly, i get 'Wrong type to apply: #<syntax-transformer getter>'
<niebie>but if i wrap them with some guile, and call the new function it works fine
<niebie>A working example is at https://gitlab.com/niebie/guile-c-sdl-sandbox/blob/master/guile_load_test.c#L55, https://gitlab.com/niebie/guile-c-sdl-sandbox/blob/master/scm/modules/niebie/game/c-interface.scm#L19, https://gitlab.com/niebie/guile-c-sdl-sandbox/blob/master/scm/modules/niebie/game/states.scm#L82, https://gitlab.com/niebie/guile-c-sdl-sandbox/blob/master/scm/modules/niebie/game/types.scm#L48
<niebie>but if i change https://gitlab.com/niebie/guile-c-sdl-sandbox/blob/master/guile_load_test.c#L54 to scm_c_public_ref("niebie game types", "state-name");
<niebie>then it give that error
<niebie>i'm trying to give as much detail as i can - let me know if i need to clarify further
<niebie>note that it can be tested in guix using the ./env.sh script, and calling 'make run-test'
***Raimondii is now known as Raimondi
<amz3`>héllo #guile
<rain1>hi!
<OrangeShark>hello everyone
<jlicht>o/
<cmaloney>morning
<turlando>I'm building a list with (list x1 x2 x3). I want the output elements of a map inside that list. (list x1 x2 (map f l)) will of course produce (list x1 x2 (x3 x4 ...)). Is there a way to "unpack" the list so that it will result in (list x1 x2 x3 x4)?
<OrangeShark>turlando: is the map applied to x1 and x2 as well?
<turlando>OrangeShark no, it isn't
<OrangeShark>only applied to the last element of the list?
<rain1>I think the thing you need is (list* x1 x2 (map f l))
<rain1>sorry cons*
<turlando>OrangeShark, rain1 this is an example of what I want to achieve in python: [1, 2, *[x+2 for x in [1, 2]]] #=> [1, 2, 3, 4]
<turlando>I'm using a comprehension instead of a map, the concept is the same
<OrangeShark>turlando: okay then you can use what rain1 suggested and use cons*
<turlando>Thanks to both, I'll try that :)
<OrangeShark>(cons* x1 x2 (map f l))
<turlando>OrangeShark doesn't seem to work as expected https://pastebin.mozilla.org/9083801
<OrangeShark>turlando: remove the '() at the end
<OrangeShark>the last argument will be the tail of the list
<rain1> https://pastebin.mozilla.org/9083803
<OrangeShark>oh, did not notice there was something after the list
<chris-l>guilers - is the best practice for macros nowadays syntax-case?
<amz3`>civodul: did you try my patch against skribilio?
<civodul>amz3`: not yet!
<civodul>hopefully soonish
<amz3`>no problem