IRC channel logs

2021-10-04.log

back to list of logs

<stis>7600 rows of scheme in about one month. Quite intensive hackingnow
<daviid>the manual lists program-arities, which seems exported but undefined - from (system vm program)
<daviid>vijaymarupudi, str1ngs (all g-golf users): I just pushed two patches, to override gtk-list-store-new [so users only need to pass a list of g-type(s), not its length anymore] and gtk-text-buffer-insert (and insert ofc) [so users only pass the three first args, not the text length in bytes anymore] - when you wish, pull, make and adapt your code ...
<daviid>sneek: later tell tohoyn I pushed two patches, to override gtk-list-store-new [so users only need to pass a list of g-type(s), not its length anymore] and gtk-text-buffer-insert (and insert ofc) [so users only pass the three first args, not the text length in bytes anymore] - when you may/wish, pull, make and adapt your code ...
<sneek>Okay.
<daviid>vijaymarupudi: wrt guix, though i 'follow the project', i don't use guix, so i'll let guixers answer your quiz and help you ... there is a g-golf package, my guess is you'd need to 'constantly' locally adapt the commit, rehash and locally build/install ... i don't thinkthere is such a thing as a 'pull/make ... danse' in guix
<vijaymarupudi>ArneBab: That article looks great for getting started, thank you!
<sneek>Welcome back vijaymarupudi, you have 1 message!
<sneek>vijaymarupudi, ArneBab says: I recently wrote how to install custom libraries in practice. It should take you the way to package your own version of g-golf: https://www.draketo.de/software/install-on-guix
<vijaymarupudi>daviid: I see, I'll figure it out, thanks!
<vijaymarupudi>daviid: That's also a great usability change!
<tohoyn>fnstudio: R7RS: It is an error if any argument of / other than the first is
<tohoyn>an exact zero.
<sneek>Welcome back tohoyn, you have 1 message!
<sneek>tohoyn, daviid says: I pushed two patches, to override gtk-list-store-new [so users only need to pass a list of g-type(s), not its length anymore] and gtk-text-buffer-insert (and insert ofc) [so users only pass the three first args, not the text length in bytes anymore] - when you may/wish, pull, make and adapt your code ...
<tohoyn>fnstudio: however, guile gives (/ 1.0 0) = +inf.0
<tohoyn>fnstudio: R6RS: If all of the arguments [of /] are exact, then the divisors must all be nonzero.
<ArneBab>vijaymarupudi: glad to help :-)
<ArneBab>daviid: there’s a refresh command that does something in that direction. Or at least did, when I last checked about a year ago.
<tohoyn>daviid: the imported method gtk-text-buffer-insert still takes four arguments, see https://paste.debian.net/1214241/
<daviid>this is expected, the C funtion still expect 4 args of course ... beside, it is tested, but your code queries g-golf 'internals', when you want to test, you should write a test that uses the method ...
<daviid>tohoyn: i now remember we had similar talks in the past, and that i toldyou need to implement your own overriding mechanism in theme-d-golf ... this might help you, to look at other overridden functions/methods ...
<daviid>tohoyn: here is an example - https://paste.debian.net/1214242/
<wingo>moin
<tohoyn>daviid: would it be good if gtk-list-store-new took classes as arguments instead of symbols?
<wingo>civodul: you will be very amused to find, i just upgraded wingolog.org to guile git, from 2.2; it worked fine. but...
<wingo>the way that the "config" worked was that there is a module (tekuti config) which had definitions like *admin-user* and *admin-pass*
<wingo>and you could specify a config file on the command line which would essentially be included into that module
<wingo>but of course the compiled (tekuti config) was declarative and cross-module inlining was available
<wingo>so the default password got inlined into its use site!!!!!!
<opfez>hi! i'm trying to do a http post request using guile, but i can't figure out how. does anyone know of or have an example of a post request i could look at?
<opfez>i've looked in the manual, but it seems i'm doing something wrong since i just recieve an http 400 error
<opfez>for reference, this is the command i'm trying to get to work: (http-post "http://ttm.sh" #:body "shorten=http://example.com")
<fnstudio>tohoyn, ah that makes sense, got it, thanks!! (and sorry for the slow reply)
<lloda>array-index-map! is a very limited function. If you do the work of traversing an array then you have a reference to each element and reading or writing shouldn't cost extra. And of course it only takes one array argument.
<lloda>array-slice-for-each lets you read or write as you please but it doesn't carry indices
<tohoyn>new debianized version G-Golf 0.1.0v7 has been released, see http://www.iki.fi/tohoyn/g-golf-debian/
<civodul>hey!
<civodul>wingo: just read what you wrote earlier about Tekuti
<civodul>amusing indeed :-)
<wingo>also i fixed that cse failure to optimize :)
<wingo>haven't been able to hack on the weekend in months :P
***tricon_ is now known as tricon
<civodul>wingo: heh :-)
<tohoyn>new version Theme-D-Golf 0.9.6-1 has been released, see http://www.iki.fi/tohoyn/theme-d-golf/.
<tohoyn>the new version of Theme-D-Golf is compatible with G-Golf version 0.1.0v7-1
<chrislck>experienced schemers, is it possible (even via macros) to have a python-style format-string with access to local bindings?
<chrislck>eg (define temp "hot") (super-format #f "the sand is ${temp}")
<chrislck>(string-join `(the sand is ,temp) " ") isn't what I'm after :)
<chrislck>the format-string will be translatable.
<RhodiumToad>I guess you'd need some kind of unhygenic macro that takes the string and converts it to something like (super-format #f "the sand is ~1" temp)
<RhodiumToad>oh, hm, if you want it to be translatable at runtime, that's much harder
<lloda>the ergonomics of something like (fmt #f "the sand is " temp) look about the same to me and that's trivial to implement :-|
<RhodiumToad>maybe two steps: at compile time, generate (super-format #f "the sand is ${temp}" `((temp . ,temp)))
<lloda>that's what srfi-166 does i think
<chrislck>oh that;s true, difficult isnt it
<RhodiumToad>basically, the local bindings can't be known at run time, so somehow all local references must be captured at compile time
<chrislck>how about positional args (super-format #f (_ "the $1 is $2") "sand" "hot")
<chrislck>_ = gettext
<RhodiumToad>yes, you can do those already (not quite like that)
<chrislck>(maybe this will require string-replace-substring)
<chrislck>toad: how??
<RhodiumToad>(format #f "the ~1@*~a is ~0@*~a" "hot" "sand")
<RhodiumToad>returns "the sand is hot"
<chrislck>🤢 but ok, if it's the only way...
<RhodiumToad>well, it's the way that (ice-9 format) currently supports
<RhodiumToad>basically, ~* changes position in the list of arguments, the @ modifier specifies absolute positioning (first arg is 0),
<chrislck>thanks, it looks like I'll string-replace-substring "$N" -> "~N@*~a" to make it palatable to translators ;)
<chrislck>:)
<RhodiumToad>obviously here the ~a could be any format specifier
<RhodiumToad>and remember that the first arg is 0, so it might be more human readable to subtract 1 from N when replacing, or perhaps provide a dummy arg 0
<chrislck>and need to distinguish between $1 and $10 etc, ugh
<chrislck>Ok: https://paste.debian.net/1214281/
<chrislck>so much loop, wow
<RhodiumToad>ugly
<RhodiumToad>wouldn't a regexp be better?
<chrislck>uhh maybe yes
<RhodiumToad>(regexp-substitute/global #f (make-regexp "$[[:digit:]]+") "the [$2] is [$1] now" 'pre (lambda (m) (string-append "~" (number->string (1- (string->number (match:substring m 1)))) "@*~a")) 'post)
<chrislck>also possibly: "the ${object} is ${temp}" can be achieved via local-eval and (devil) eval
<RhodiumToad>except you should move the make-regexp to its own variable for reuse
<chrislck>clever yes
<RhodiumToad>hm, for local-eval you'd have to capture the environment somewhere
<chrislck>also translators could hack the local machine
<RhodiumToad>sorry, pasted the wrong one, should have been:
<RhodiumToad>(regexp-substitute/global #f (make-regexp "[$]([[:digit:]]+)") "the [$2] is [$1] now" 'pre (lambda (m) (string-append "~" (number->string (1- (string->number (match:substring m 1)))) "@*~a")) 'post)
<RhodiumToad>making local-eval safe from hacking shouldn't be hard
<RhodiumToad>ok, capturing the environment requires some unhygenic macro trickery but seems to be possible
<RhodiumToad>muahahah, I made it work
<RhodiumToad>(define (foo a b) (xformat "foo: b is ${b} a is ${a}")) (foo 123 "hello") returning "foo: b is hello a is 123"
<dsmith-work>Morning Greetings, Guilers
<stis>Tja guilers!
<chrislck>👏
<RhodiumToad> https://dpaste.org/GfK1
<RhodiumToad>see ^^
<RhodiumToad>it unhygenically injects the (the-environment) syntax into the caller of xformat to get the environment
<chrislck>lol
<RhodiumToad>(without that, you get the lexical environment of the definition of the macro, instead)
<chrislck>Ta I think that'll do for now :D
<RhodiumToad>and it should be safe because it only allows ${alphanumericstring} and generates an expression consisting of just the single symbol
<RhodiumToad>I guess it could end up expanding an identifier macro, maybe, haven't checked
<chrislck>gtg now, but will ponder... this could be a nice addition to guile or guile toolbox somewhere
<RhodiumToad>yeah, if you have an identifier macro named foo, and you use ${foo} in a string, the macro's syntax expander is run
<RhodiumToad>so just don't call it when there might be dangerous identifier macros in the environment :-)
<asgas>How much of a performance hit does garbage collection put on guile?
<RhodiumToad>probably depends on how much garbage you generate
<asgas>I was thinking of extending a game with some sort of scheme dialect. Core written in C, scripted in scheme such as chicken, chez scheme, or maybe guile.
<dthompson>with any scheme implementation, you will want to avoid allocation as much as possible. gc is going to be relatively expensive across the board when considering running a game at 60hz or so.
<dthompson>on my laptop, an average gc cycle could take somewhere in the 40-90ms range, based on some unscientific observations I've done. an okay price to pay if the frequency of such gc runs is kept low.
<dthompson>when I first started with guile, back in the guile 2.0 days, I wrote C applications and linked against libguile for scripting purposes. I think many, myself included, learn the hard way that this approach isn't very good and that's it better to write a guile program that uses the C FFI when necessary instead.
<ArneBab>wingo: yikesw (re password) — I’ve been hit by declarative modules, too (leading me on an hourlong chase why the cooperative REPL could not replace anything)
<ArneBab>wingo: aside from that: great to hear that you’re hacking again!
<daviid>sneek: later tell tohoyn great, andtx for the debian pre-released unofficial g-golf package
<sneek>Got it.