<chrislck>i.e. how to access a binary buffer from C and convert to SCM <RhodiumToad>simplest method is probably to just cons it up backwards from the end <chrislck>scm_from_utf8_string is not right because of these '\0' obviously <chrislck>alternatively how to convert/case char* into #vu8 <RhodiumToad>do you want a bytevector that copies the bytes, or that aliases them? <RhodiumToad>you could easily do an extra copy if you want a copy <chrislck>now need to look into scm_gc_protect and stuff <RhodiumToad>well making a copy is probably the easiest way to avoid gc complications <ArneBab_>rlb: lokke looks like the perfect tool to get a colleague to Guile — thank you! <rlb>ArneBab_: hah, you're welcome, though it's definitely early days. <apteryx>how do I match a pair? (match pair ((a . b) ...)) or (match pair ((a b) ...)) ? <rlb>When working on lokke, remembered that if you want to make a dialect for guile that has it's own #! interpreter, you may have to generate binaries to be portable, i.e. solaris and darwin derivatives don't allow the #! target to be another #! script. <leoprikler>apteryx: for pure pairs you probably want (match pair ((a . (? (negate pair?) b)) ...)) ***apteryx is now known as Guest98549
***apteryx_ is now known as apteryx
<manumanumanu>rlb: if you want a C extension with fectors, I would suggest c-rrb. I think it is permissive, and is probably the fastest implementation of rrb-vectors around. They will be faster than fector, but also have fast concatenation, splitting and in-the-middle insertion. <manumanumanu>the cost of rrb-trees over, say, fector by andy, is a small check: (if (split-or-concatenated? fector) (sliightly-more-expensive-lookup fector index) (regular-fector-lookup fector index)) <manumanumanu>whereas splitting and concatenating is o(1)-ish instead of o(n). <manumanumanu>the other known implementation of them are arximboldi's immer c++ library which comes with basic guile bindings. That one has regular fectors (called vector) and rrb-trees called flex_vector. He reports a worst-case slowdown of 2x, but only after _excessive_ splitting and concatenating. <rekado>I’ve been playing with guile-rsvg and noticed that an error is thrown when closing an rsvg handle immediately after writing a non-ASCII character to it. <rekado>the rsvg API expects you to close the handle to indicate that no more writing will occur. <rekado>there is no such problem when using rsvg-handle-new–from-file (which does not require writing to and closing of the handle) <ArneBab_>RhodiumToad: there are systems that re-target binaries to #!-scripts <ArneBab_>RhodiumToad: for example check `head $(which guix)` <pinoaffe>hi folks, a while ago I asked about the guile repl, didn't really get a clear answer, so I'm going to ask again: does the guile repl support on-the-fly modification of state (followed by resuming execution) when an exception is raised, along the lines of the workflow described in http://mikelevins.github.io/posts/2020-12-18-repl-driven/ ? I read the article, and figured if guile support this, it could make my repl-interaction <pinoaffe>I read the repl command documentation bit didn't really understand how those commands relate to eachother <dsmith>pinoaffe: Guile (and Scheme) doen't have restartable exceptions like CL does. <dsmith>pinoaffe: Also, doesn't save the in-memory image to be reloaded later. So you can't type in definitions at the repl, save, type in, save ... <dsmith>Instead, you use geiser/emacs and type in a new def in a file, and then send that def to a running Guile. Run, Edit, Repeat. <dsmith>Very similar workflow, but you have the code in a file. <manumanumanu>pinoaffe: you could write restarts using continuations if you want to <pinoaffe>dsmith: thanks, thats what ive been doing <manumanumanu>pinoaffe: whoa. I just stumbled on something fun, that is tangential to what you are doing. (ice-9 local-eval). Trying to do something like what you are asking for is going to be fun in the bad sense! <manumanumanu>but you could write something where an error gives the error handler access to the lexical environment of the error, which means you can set! to your hearts desire <manumanumanu>(define meh 6) (define e (the-environment)) (local-eval '(set! meh 11)) (display meh) => displays 11. <manumanumanu>and it works badly with the dynamic environment, so parameters are not the same. <manumanumanu>hihi. I haven't had this much fun since the city burnt down. <rlb>RhodiumToad: sounds like #! targets can be interpreters in the minux and linux worlds (and can "recurse". Guessing the solaris/darwin claim extends to the broader *bsd world too: https://en.wikipedia.org/wiki/Shebang_(Unix)#Syntax <rlb>manumanumanu: thanks - I'll put that on the investigation list, though clojure vectors explicitly don't support concatenation or insertion if that makes a difference. <rlb>(but even if so, might be interesting to have variants that do -- have to think about it) <manumanumanu>rlb: as I said, they are a superset of clojure's persistennnt vectors. The difference is that the rrb-trees relax the balance requirement, which makes you use a lookup table whenever you have done a concat/split. if that LUT is not present, use the regular pvector lookup :) <rlb>Oh, I just meant that clojure has no operations that will allow vector concat or insertion atm. <manumanumanu>so it is really (if (LUT? fector) (more-expensive-lookup fector index) (fast-lookup fector index)) <rlb>Hmm, though I suppose maybe concat or into might be optimized to take advantage in some cases, *if* that were deemed to be acceptable wrt the actual documented behaviors. <rlb>I suppose perhaps concat shouldn't actually... <RhodiumToad>rlb: so I wonder what happens on linux if a file's #! points to itself *rlb guesses that linux has something like the symlink count limit at least... <rlb>bash: ./foo: ./foo: bad interpreter: Too many levels of symbolic links <rlb>after an echo -e "#!./foo\nsomething\n" > foo <dsmith>I wonder how many is "too many"? *rlb guesses a power of 2 <rlb>Apparently "_POSIX_SYMLOOP_MAX is 8" (at least). <dsmith>"As currently implemented on Linux, the maximum number of symbolic links that will be followed while resolving a pathname is 40." <dsmith>Right. I was looking there the error message mentioned symlinks.