IRC channel logs

2020-12-17.log

back to list of logs

***sneek_ is now known as sneek
<ArneBab>manumanumanu: nice!
<tohoyn>sneek: botsnack
<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?
<seeg123>ah indeed!~
<chrislck>manumanumanu: for-each is ingrained in my muscle memory...
<chrislck>Happy Thursday, guilers!
<civodul>:-)
<dsmith-work>UGT Greetings, Guilers
<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>scope isn't relevant, anyway
<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
<chrislck>ah
<chrislck>thx
<chrislck>mark-and-sweep
<civodul>wingo: hi! i stumbled upon this define-syntax-parameter redefinition issue: https://issues.guix.gnu.org/27476#35
<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
<wingo>is there still a problem?
<civodul>no no, i was just wondering whether i could remove the workaround
*civodul tries
<wingo>cool :)
<wingo>fixed in theory on 2.2 as well (not sure which release, but after feb)
<wingo>feb 2019 i mean
<civodul>wingo: confirmed, it all looks good!
<wingo>yay
<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>normally the first of those
<fnstudio>RhodiumToad: excellent, thanks
<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))
<RhodiumToad>all good candidates for "don't do this"
<dsmith-work>heh
<jkossen>hello, i'm trying to sort a list of integers. Reading https://www.gnu.org/software/guile/manual/html_node/Sorting.html but what should i put in place of 'less'?
<joshuaBPMan>Hello guile people!
<dsmith-work>scheme@(guile-user)> (sort (list 9 1 2 8 3) <)
<dsmith-work>$1 = (1 2 3 8 9)
<dsmith-work>jkossen: ^^
<dsmith-work>jkossen: See the descripton for sorted? for what "less" looks like.
<dsmith-work>So
<dsmith-work>scheme@(guile-user)> (sort (list 9 1 2 8 3) >)
<dsmith-work>$2 = (9 8 3 2 1)
<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
<dsmith-work>Watch that '
<pinoaffe>?
<jkossen>Advent of Code day 5 solved. Yay :-P
<pinoaffe>jkossen: nice!
<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?
<pinoaffe>yeah
<jkossen>awesome
<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>Does sort return a new list?
<dsmith-work>Well, it doens't yell at me...
<dsmith-work>Rght. "NeverMind"
<RhodiumToad>sort is not destructive
*dsmith-work goes back to arguing with nodejs and node-red...
<dsmith-work>Yeah, sorry for the noise..
<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.
<dsmith-work>jkossen: If not, they ought to.
<pinoaffe>RhodiumToad: yeah, so I should probably change my habit :)
<spk121>oh hey, GTK4 is officially released