IRC channel logs

2017-03-31.log

back to list of logs

<IHateIrc>void_pointer: yup. SCIP
<IHateIrc>actually SICP
<void_pointer>Haven't actually done the book myself. Have looked at it in a couple places though. I learned scheme from "Teach Yourself Scheme in Fixnum Days", the Guile Manual, the R6RS standards documents, and some writing by many different people on macros
<IHateIrc>I glanced over the r5rs document. I didn't read it VERY throuhly. I need to learn more about delimited continuations and some other things that didn't make sense.
<zv>gyep
<zv>also, gotta spam myself here
<zv>cuz SICP
<zv> https://github.com/zv/SICP-guile
<mg_>I'm wrapping a c api (with (system foreign) stuff), and it makes sense to express it through goops I think. Is there any hook I can set up so that I free the appropriate resources when an instance is gced? Or do I have to do that manually
<mg_>2
<wingo>mg_: see the foreign object docs for 2.2, you can attach a finalizer
<wingo>ACTION sent sandbox module to guile-devel; review welcome
<wingo>mark_weaver: hey, your thoughts very welcome re: sandbox proposal on guile-devel
<mg_>wingo: thanks. I'm on 2.0.13 currently (nixos). But I chose to make a c wrapper instead, which I saw had the finalizer argument
<mg_>and on that note, is there a good way to go from a c array of stuff to a scm list?
<wingo>not a great way, no -- you have to do that manually
<mg_>so basically start with an empty list, loop the array and build with scm_list_2(scm_from_something(item), list) ?
<wingo>build with scm_cons from the back
<wingo>res = SCM_EOL; while (n--) res = scm_cons (scm_from_something (items[n]), res);
<wingo>something like that
<mg_>right. Couldn't find scm_cons in the docs, makes sense that that exists!
<mg_>Thanks alot mate :)
<daviid>hello guilers!
<mg_>does anyone have any links to what you consider well written guile c extensions?
<civodul>mg_: i think you can check things like guile-cairo, guile-rsvg, guile-ncurses, etc.
<civodul>well, these are all bindings, not sure if that's what you're looking for
<civodul>if you're writing bindings, i recommend using (system foreign) instead of the C API
***random-nickname is now known as random-nick
<mg_>civodul: any specific reason for that?
<mg_>I'm writing a binding to a c++ lib
<mg_>(but it has a c interface included, it that matters)
<mg_>I tried going down that route first, but couldn't find any info on how to e.g. handle c enums
<daviid>mg_: there is (rnrs enums)
<daviid>guile-squee use this module: https://notabug.org/cwebber/guile-squee/src/devel/squee/enum.scm
<daviid>I use goops, in g-golf, because g-golf will use goops anyway, here is the module, for info http://git.savannah.gnu.org/cgit/g-golf.git/tree/g-golf/support/enum.scm and here is an example of use of it to define <genum> it http://git.savannah.gnu.org/cgit/g-golf.git/tree/g-golf/gobject/enum-flags.scm and using it http://git.savannah.gnu.org/cgit/g-golf.git/tree/g-golf/gi/types.scm
<daviid>mg_: ^^
<civodul>ooh i didn't know these
<civodul>mg_: the FFI allows you to write pure Scheme code, which is generally more "fun" and more flexible
<civodul>you can do live hacking as well
<civodul>but for enums, yeah, either you use sophisticated machinery to determine the enum values
<civodul>or you hardcode them as Scheme constants
<civodul>which is generally okay if the C library has a reasonably stable ABI
<dsmith-work>Happy Friday, Guilers!!
<mg_>daviid/civodul: thanks for the pointers (no pun intended). I'll take a look tonight
***Guest31748 is now known as micro`
<dsmith-work>mg_: The ffi will be even nicer when guile generates native code. Who knows, might be able to inline the calls and be more efficient than the C wrappers.
<mg_>dsmith-work: that would be nice! I guess I'm more used to C style languages so that feels simpler, but the goal is to learn so (system foreign) it is
<dsmith-work>mg_: Yeah, C is my native tongue, so I usually reach for it first too.
<mg_>hm, how do i deal with a signature like "int some_func(enum some_enum **stuff)?
<paroneayea>ACTION implementing a fun stack based language on top of guile
<janneke>,L postscript? ;-)
<paroneayea>janneke: nope! it's kind of like PushGP, but it uses generic methods which "search" the stack for applicable values rather than have different stacks for each type
<paroneayea>janneke: I plan to write a genetic programming environment on top of it.
<janneke>whoa, paroneayea!
<paroneayea>:)
<paroneayea>the goal is to have a distributed anti-abuse system
<paroneayea>where your anti-abuse programs make babies with the programs of people you trust
<paroneayea>who knows if I'll get there
<paroneayea>in the meanwhile it's fun to explore
<janneke>:-)
<zv>did you know that the word 'guile' comes from the anglo-saxon 'wign' meanings "witchcraft"
<civodul>fun :-)
<dsmith-work>wile
<gazon>zv: i would love to know source of that entomological info
<zv>entomological :)
<zv>buzz buzz
<zv>etymological
<zv>google
<dsmith-work>Yeah, words are fun
<gazon>*blush*
<dsmith-work>I was surprised to know that my name and "dollar" are related.
<dsmith-work>Ah. The "Dale" part, not the "Smith" part.
<zv>"wign, wigle: divination, sorcery"
<ArneBab_>zv: I didn’t know it, but that’s nice :)
<random-nick>zv: wign is just a few letters away from wingo
<zv>true enough
<daviid>haha
<dsmith-work>Hmmmm
<zv>Guile is cool
<zv>I've had quite a few code-gen bugs, especially in recent versions.
<zv>and SRFI-64
<zv>but other than that, Guile is witchcraft as far as I'm concerned