***sneek_ is now known as sneek
<seeg123>hello, how can i get directory of the current script? This is different from (getcwd) <rekado>seeg123: perhaps (current-filename) is what you are looking for? <chrislck>manumanumanu: for-each is ingrained in my muscle memory... <chrislck>if a C snippet allocates eg. SCM scm = scm_list_2 (SCM_BOOL_F, SCM_BOOL_F); how does the bdmgc know when to gc scm? <chrislck>there's no let() clause to define the scope <chrislck>is there a periodic sweep that somehow mops up all SCM objects, whether allocated in guile or C? <RhodiumToad>in that example what's being allocated are cons cells, and those will be freed when there's no reference to them from anywhere that the GC knows about <RhodiumToad>the GC scans the C stack and registers of all threads, so any C local variable reference to the value will normally stop it from being GC'd <civodul>i thought we had fixed it, but apparently not; does that ring a bell? <civodul>(there's a workaround in Guix so no rush, but i was considering getting rid of it) <wingo>in theory 61a8c9300daeb730fe5094f889bf13241942be84 fixed it <civodul>no no, i was just wondering whether i could remove the workaround <wingo>fixed in theory on 2.2 as well (not sure which release, but after feb) <civodul>wingo: confirmed, it all looks good! <fnstudio>hi, suppose i want to create a generic function, say it's called `get-data`, and then i want it to behave differently by means of passing an `import-proc` <fnstudio>so that'd be `(define (get-data input import-proc) ...)` <fnstudio>can i simply use `import-proc` straightaway in my function definition? "straightaway" as in `(import-proc ...)` <fnstudio>or should i instead use something specific... eg `(<some-built-in-proc> import-proc ...)` <RhodiumToad>scheme is a lisp_1, that is symbols have only one value, not separate value and function slots <RhodiumToad>the form (func arg1 arg2 ...) evaluates all of its elements the same way, then applies the first value to the remainder <RhodiumToad>so you only need constructs like (apply func args) where the number of args is not fixed <fnstudio>RhodiumToad: thanks (and it looks very elegant) <RhodiumToad>you can even write things like ((lambda (x) ...) arg) ;; but you usually shouldn't <fnstudio>ah right, yes, i think i've seen it - at least as an example <dsmith-work>((if (some-predicate) + *) 3 4) => either 7 or 12 depending on (some-predicate) <ane>not to mention doing something silly as (let ((+ -)) (+ 1 2 3)) <dsmith-work>jkossen: See the descripton for sorted? for what "less" looks like. <jkossen>Thanks dsmith-work. I did try that, but since it works for this simple list I guess i'm doing something wrong elsewhere... <joshuaBPMan>I'm thinking about building a dating web app for 25,000 users or so. (That is I hope to inspire 25,000 people from my city to use it. That's a big IF). <jkossen>ah d'oh. thanks dsmith-work, i was indeed looking in the wrong place <pinoaffe>I just realized I've always been doing (sort '(3 2 1) <=) rather than (sort '(3 2 1) <), even though the variable name suggests a "less" function <pinoaffe>probably because using a less-or-equal is often a more "basic" operation in mathematics <jkossen>Advent of Code day 5 solved. Yay :-P <pinoaffe>I've been doing all of them in guile this year <jkossen>still feels like i'm talking to aliens when writing scheme though :P <jkossen>could have solved 5 a lot easier too. Oh well, it works <pinoaffe>I always "cheat" and edit the input manually so it's an s-expression :) <jkossen>heh, ok that's one cheat I didn't use. And i didn't peek at tips or other solutions :P <jkossen>pinoaffe: you've solved them all up to now? <RhodiumToad>pinoaffe: sorting functions usually need < and if written to use < may well explode if you pass a <= function instead <dsmith-work>pinoaffe: Using quote in newish Guile makes a constant expression. And so could be read-only. And errors if you try and write. Hmm. *dsmith-work goes back to arguing with nodejs and node-red... <jkossen>don't all destructive functions end with a ! ? <dsmith-work>Ah, but sort! *does* get angry at a quoted (and so non-mutable) list. <pinoaffe>RhodiumToad: yeah, so I should probably change my habit :) <spk121>oh hey, GTK4 is officially released