IRC channel logs

2018-06-12.log

back to list of logs

***Raimondii is now known as Raimondi
***Raimondii is now known as Raimondi
***Raimondi^2 is now known as Raimondi
***Raimondi^2 is now known as Raimondi
***Raimondii is now known as Raimondi
<ArneBab_work>it would be interesting to see the Guile FFI in this FFI overhead benchmark: https://github.com/dyu/ffi-overhead (also the existing results are pretty interesting — explained here: https://nullprogram.com/blog/2018/05/27/ )
<hugo>Interesting tactic. Joining, posting, and leaving
<hugo>Anyhow, should be easy enough to add guile to that list, if anyone feels so inclined.
***Raimondii is now known as Raimondi
<lloda>format ~NNy doesn't work very well. If you pass it a long list of numbers it will print a single column of numbers, regardless of NN. E.g. (format #t "~20y" (iota 10))
<lloda>I would have expected some attempt at line wrapping
<manumanumanu>lloda: I know what you should not do. Don't read the format source code.
<manumanumanu>Oh no. Now I did it :(
<hugo>manumanumanu: I haven't read it. But it kinda has to be complicated since it implements its own DSL for string formatting
<manumanumanu>hugo: let me just say, it is worse than you think. I read it and decided I would forever use ashinn's fmt
<lloda>manumanumanu: haha
<lloda>but I think in this case it's the fault of pretty-print, format just forwards to that
<lloda>the hairier format parts is things like ~{, ~[, etc
<rain1>i think format should have an equivalent s-exp format.. which the strings are just a shorthand for
<hugo>manumanumanu: Is that a alternative library?
<lloda>is that what fmt does? but, it's hard not to use what's built in :-/
<manumanumanu>hugo: yup. it will probably be the format of r7rs-large
<hugo>rain1: I agree. I'm thinking of something similar to how the PEG library works
<rain1>you could even implement it with peg :D
<hugo>manumanumanu: srfi-159?
<manumanumanu>hugo: yes, something like that
<hugo> https://srfi.schemers.org/srfi-159/srfi-159.html if anyone else want to read it
<hugo>Looks really good. Will play a bit with it once I have time
***rubdos_ is now known as rubdos
<manumanumanu>clojuresque lambda shorthand for those who want it: https://bitbucket.org/bjoli/megacut/src/default/megacut.scm
<manumanumanu>the source is a mess, but I just hammered it out.
<manumanumanu>(megacut (apply + % %&)) => (lambda (%1 . %&) (apply + %1 %&))
<manumanumanu>with a read-hash-extend shorthand #%(+ % %) => (megacut (+ % %))
<manumanumanu>I might switch the syntax to a more cut-like syntax, like #%(+ <1> <2>)
<hugo>manumanumanu: Does it also support nested expressions? Something like #%(+ 2 (* %1 2))
<manumanumanu>hugo: yes
<manumanumanu>arbitrarily deep
<manumanumanu>Maybe it is not a good idea to call it something with cut, since it has different semantics
<hugo>Good work then!
<hugo>cut is so much weaker than I would like. Maybe something like clj-lambda could work
<hugo>I do however like the <n> syntax
<manumanumanu>hugo: yeah. it feels consistent with cut, which is similar in a way. The whole %n looks weird once you have gotten used to the also pretty weird <>
<hugo>But you are kinda forced to have weird syntax to not clash with other bindings
<hugo>Guile even warns against using defmacro for that reason
<manumanumanu>well, for this it doesn't really matter since the point of %n would be to break hygiene. In fact, I wrote it using define-macro first
<jlicht>civodul: thanks for your advice from yesterday! I'm now wondering on how to pass in an 'out-param' size_t, (so size_t*) and read it out afterwards. The FFI system keeps thinking I'm talking about a pointer to a pointer, instead of a pointer to a size_t though
<civodul>jlicht: to pass a size_t*, you need to pass: (bytevector->pointer (make-bytevector (sizeof size_t)))
<civodul>after the call you need to dereference that with bytevector-uint-ref
<civodul>this is pretty verbose and tedious, but doable :-)
<civodul>you can look at guile-gdbm-ffi or guile-git for examples
<jlicht>That is why I'm doing this: I'm trying to extend guile-git atm, so I will look further for inspiration there :-)
<jlicht>thanks!
<civodul>excellent
<civodul>guile-git needs love
<civodul>and releases too :-)
<jlicht>`define-libgit2-type' in (git types) has either pulled my guile-fu to the next level, or crushed my sanity. Not sure yet which
<jlicht>it works. The bytevector-uint-ref stuff is tedious though
***Raimondii is now known as Raimondi
<megane>hello
<megane>why doesn't this work: ((reset (λ () (shift k (k 42)))))
<megane>but it does if i wrap it into an extra reset
***Raimondii is now known as Raimondi
<hugo>megane: when I evaluate your expression I get 42