IRC channel logs
2023-10-02.log
back to list of logs
<minima>RhodiumToad: thanks for the tip re `format' and `~:*'! <wingo>civodul: it aborts because of a failed invariant in jit.c <wingo>i would imagine someone has seen it before, not sure... will fix in any case <civodul>wingo: oh ok, i don’t remember seeing it <RhodiumToad>I was looking at how much would need to change to make it usable <ekaitz>as you are talking about it, is there any way to insert raw strings in sxml in guile? <ekaitz>if you do it like (el (@(...) that-string) it escapes it, right? <RhodiumToad>you want to write out an sxml tree as xml, but include literal xml fragments in it? <ekaitz>in chibi i added a @raw tag for this <ekaitz>there's the option to convert to sxml and combine it back and then convert everything to string <RhodiumToad>if an sxml element is a procedure, it's called as (with-output-to-port port tree) <RhodiumToad>(define (raw-xml txt) (lambda () (display txt))) (sxml->xml `(foo ,(raw-xml "<x>zzz</x>"))) <RhodiumToad>that also works for applicable structs as well as lambdas, so you can define objects that print themselves unescaped <RhodiumToad>(anything in an sxml tree that isn't otherwise recognized is displayed to a string and then escaped, so normally printable objects would get escaped that way) <apteryx>what is the tradeoff when using transducers vs composing plain list-manipulating procedures? <RhodiumToad>transducers allow you to compose a lot of operations without using intermediate lists <RhodiumToad>the ability to do your own transducers and reducers independently also allows quite a lot of scope <apteryx>i'd hazard I guess that it probably uses a bit more computation (CPU) but less memory <RhodiumToad>probably more than open-coded loops since those probably provide more opportunity for compile-time optimizations <old>RhodiumToad: is there example of usage of transducer? I look over the doc quickly couple of times, but never tried them <old>my understanding is transforming a O(k * n) operation into O(n) where n is the lenght of the list and K the number of transformation? <RhodiumToad>the basic idea is that, say, (list-transduce (compose blah1 blah2 blah3) reducer original-list) is the equivalent of doing something like (reducer (blah3 (blah2 (blah1 original-list)))) where the various funcs are things like "filter" or "map" operations, <RhodiumToad>and if one of the operations stops early, then the whole pipeline is stopped <RhodiumToad>the various transducer steps can add or remove items, group items together, etc <RhodiumToad>also the transducers and reducers don't need to care about whether the original input is a list, vector, generator, etc. <dsmith>I haven't looked at transducers yet, but it doesn <dsmith>but it sounds a lot like rust iterator adapters <graywolf>Hello :) Do we have something like thread-last (->>) from clojure in the Guile? Just asking before I try to write my own. <old>graywolf: I do not know clojure, but I've never seen `thread-last' in guile. Could you expand on it? Perhaps there is something similar <graywolf>old: Sure, (->> 1 inc (* 90) (/ 2) (+ 3) dec) produces 721/180; It processes the forms in sequence and adds the value into last place of previous form. <old>graywolf: looks like monad? <old>there no form like that in Guile, but if you give me couple of minut I can hack a syntax rule for you <graywolf>old: No no, I appreciate the offer, but I want to give it a try on my own :) <old>graywolf: I have something if you want ^^ cool exercice <old>let me know if you want to comparse solution :) <sneek>This system has been up 26 weeks, 1 day, 22 hours, 51 minutes <mwette>Rust also has "nom" which used compositors etc for building stream parsers <haugh>graywolf and old, be advised of SRFI-197 <haugh>no implicit threading, though <graywolf>haugh: Oh, I like the _ quite a bit. Thanks for the link, will read it in depth. <graywolf>BTW is there a list of "commonly useful" srfis? There is a lot of them, and I am not sure where to start. Do people just read them from the first? <old>search for things you like :-p <old>and see if guile has them <RhodiumToad>I think the thing that annoys me most about them is the multiple values issue - there are like 4 ways to deal with multiple values and they're all somewhat dubious <RhodiumToad>call-with-values is low-level, receive is nice but limited, let-values needs too many parens, srfi-71 let overrides core syntax <old>RhodiumToad: I always use call-with-values now <old>I'm just lazy and do not want to add #:use-module for this <RhodiumToad>also guile's srfi-71 fails to export half the required functions <old>If let-values were in (guile) so directly in the language I would use it <old>simple usage: (->> (iota 10) (filter odd? <>) (map sqrt <>)) <old>should give you the square root of odd numbers up to 10 <haugh>The annoying thing about multi-values for me has always been the need to check for truth, since `and' and `and=>' can only pass one value. I have a draft of a modified `receive' which adds some convenience, but it's a little terse and unconventional and currently uses the same name in order to support the original behavior <haugh>It's going in my as-yet-unpublished collection of Things To Make Typing Guile Faster <haugh>it's got to be compatible, so the left-most <haugh>the scheme doctrine seems to be that everything which is not #f is true <haugh>furthermore, (if (values #f #t) #t #f) => #f <haugh>in a language with polycovariadic functions, that is a frustration <lilyp>friendly reminder that compose passes multiple values fine and cute exists :) <haugh>I do use the hell out of compose but it there's no compose-and. Also probably worth considering it creates a procedure <haugh>in point of fact, creates one polyvariadic proc and one thunk per composed procedure <minima>hi :) anyone can point me to a simple makefile to install a mono-file guile app? i can find various examples for guile libraries but what do i do for a script? do i copy the `.scm' to the system's PATH? do i drop the file extension and make it executable? <minima>the few examples i've found seem to: 1) compile the scheme file with guild; 2) copy the scheme file to /usr/local/share/guile/3.0 and the go file to /usr/local/lib/guile/3.0/ccache <minima>(with the /usr/local bit depending on the specific system) <RhodiumToad>that's for modules which are to be loaded with use-modules or whatever <RhodiumToad>if there's a way to precompile the actual script as opposed to modules it loads, i don't know what it is <minima>RhodiumToad: do i need to precompile it? the makefile above seems to only remove the extension and make the file executable? <minima>what it's still unclear is how the executable file ends up in my path <RhodiumToad>if you don't, though, every user who uses it will get a compiled copy in their own ~/.cache/guile/... <minima>ah that's a makefile thing... i'm looking into that now, thanks graywolf <minima>graywolf: this makes much more sense now :) ty!