IRC channel logs

2020-03-08.log

back to list of logs

<daviid>str1ngs: ok, great
<sneek>daviid, you have 1 message.
<sneek>daviid, str1ngs says: thanks will check this out ASAP.
***dsmith` is now known as dsmith
<dsmith>Ooo.. Sounds like 3.0.1 is immanent!
***apteryx is now known as Guest95484
***apteryx_ is now known as apteryx
<manumanumanu>civodul: there is a bug in how sxml handles CDATA. I submitted a guile patch, but it should probably be updated upstream.
<manumanumanu>regarding what RhodiumToad said
<manumanumanu>I did it just as an intellectual curiosity, so I didn't bother actually subitting it upstream
<manumanumanu>because I did not have a sourceforge account :=)
<manumanumanu>Does anybody know of an rrb-tree fector for scheme or guile? I only know of "regular" fectors. I have read enough about them to be able to implement them myself, so I might give it a shot
<civodul>hi manumanumanu!
<civodul>do you have the URL of the patch?
<manumanumanu>2 seconds
<manumanumanu>civodul: https://lists.gnu.org/archive/html/guile-devel/2020-01/msg00081.html
<manumanumanu>It passes the internat ssax tests, but I did not verify it more than just playing around with it. It is a rather straight-forward patch: IIRC I simply removed the handling of & from CDATA, which is the correct way to handle it anyway. The complexity of the patch comes from the changes to the test suite, which were NOT straight-forward to do since guile does not write out what went wrong or which test was
<manumanumanu>affected.
<civodul>are you sure there's no upstream fix?
<civodul>i'd rather avoid diverging from upstream
<civodul>especially in a file that contains "upstream" in its name :-)
<civodul>(it might be that there really isn't an "upstream" anymore)
<manumanumanu>well, all scheme implementations use the upstream
<manumanumanu>even the racket pkg
<manumanumanu>I'll shoot an email to oleg or whoever is in charge of the repo
<manumanumanu>and see what happens
<stis>hej guilers!
<civodul>manumanumanu: awesome, thanks!
<civodul>manumanumanu: oh there's also this srfi-171 patch of yours that's still pending
<civodul>i see you have a copyright assignment on file, great
<dftxbs3e>hi! I'll ask again since this was unanswered, is it possible to launch services with shepherd while GNU Guix is running on top of another distro, say a minimal install of Gentoo with OpenRC?
<civodul>hi dftxbs3e!
<civodul>i think that's the wrong channel :-)
<civodul>but the short answer is yes, Shepherd is not Guix-specific
<civodul>however, you'll have work to do to define your services
<civodul>you won't be able to use the Guix System infrastructure
<dftxbs3e>civodul, oh woops!! sorry
<dftxbs3e>thanks for the answer nonetheless
<civodul>yw!
*civodul prepares 3.0.1
<str1ngs>hello daviid, (gtk-application-get-active-window app) does not seem to work right if no active window exists. It should return NULL or in the case of scheme #f. You could test this by not calling activate and trying to open files. something like ./open.scm ./foo ./bar. if no default application is running or active window exists this will throw 'wrong-type-arg. For now I just catch 'wrong-type-arg and create a frame if needed. But
<str1ngs>typically in C I would just use something like this. if (!gtk_application_get_active_window (GTK_APPLICATION (app))) { create frame here... }
<str1ngs>daviid: here is the documentation for 'gtk-application-get-active-window https://developer.gnome.org/gtk3/stable/GtkApplication.html#gtk-application-get-active-window
<civodul>Guile 3.0.1 is out! :-)
<civodul>(it's a recurring theme this week-end)
<mbakke>civodul: \o/
<mbakke>any news on the ARM/AArch64 issues?
<RhodiumToad>civodul: re. the sxml thing, I mentioned the bug on the supposed "upstream" sourceforge repo, but no response (not all that surprising since there had been no messages for 4 or so years)
<civodul> https://www.gnu.org/software/guile/news/gnu-guile-301-released.html
<civodul>mbakke: the ARM JIT issue is not fixed, but we can still --disable-jit
<civodul>the AArch64 issue is "fixed" as a side effect of some other change
<civodul>as in, it's able to build Guix now
<civodul>but the root cause may still be there
<rekado>I’m confused about port encodings when using the web server. The port encoding of (current-output-port) is set to ASCII. Is it okay to set that to UTF-8 or will that lead to problems when sending responses to the client?
<rekado>This is motivated by broken file name encoding when handling form data.
<mwette>civodul: congrat's on the release
***jao is now known as Guest17867
<civodul>thanks, mwette!
<civodul>rekado: shouldn't it be a function of "content-encoding"?
<rekado>civodul: content-encoding is for compression. Do you mean content-type?
<rekado>content-type here is multipart/form-data
<RhodiumToad>encoding could be different for each part, then, at least in theory
<RhodiumToad>the wonders of MIME
<rndd>Hello everyone!
<RhodiumToad>good evening
<rndd>i have a question. A newbe one. Suppose I have a character that may be a member of the list, and if my character is a member, i need to know its index in list. How i can do such thing in guile?
<RhodiumToad>list of characters? i.e. like '(#\a #\b \#c etc)
<rndd>RhodiumToad: ye
<RhodiumToad>list-index from srfi-1 seems like a good place to start?
<RhodiumToad>though if you do this a lot, then maybe lists aren't the best data structure to use
<rndd>RhodiumToad: maybe, i'm just practising new language. thanks, it seems list-index fits my needs
<rekado>apart from the content-type: in the server handler I use “(open-file "ä" "ab")” and then write a bytevector to the file; the file that is created, however, is called “?”.
<rekado>why is that?
<RhodiumToad>what's telling you that it is called ?
<rekado>I’m ignoring whatever might come from the form.
<rekado>my file system
<rekado>I look at the current directory in a shell
<RhodiumToad>what OS and looking with what utility?
<rekado>there is a new file “?” when I run “ls”
<rekado>brb
<RhodiumToad>ls will have an option to display file names with escapes for non-ascii characters, try it
<rndd>RhodiumToad: sorry, maybe i dont understand, but when i enter example from manual "(list-index odd? '(2 4 6 9))" in repl, i get an error "In procedure car: Wrong type argument in position 1 (expecting pair): #<procedure odd? (_)>"
<sirgazil>rndd: You need (use-modules (srfi srfi-1))
<rekado>rndd: run ,use(srfi srfi-1) frist
<sirgazil>:)
<RhodiumToad>there's a list-index in base that isn't in the manual?
<RhodiumToad>yeah, and it looks like it has a completely different calling convention
<rekado>oops
<rndd>okay =)
<rndd>guys, where i can find source code of these moduls in guix&
<rndd>?
<RhodiumToad>ya, found it; ice-9 boot has a definition of (list-index l k) that just uses eq? for comparison
<rekado>here’s a test case for a ’?’ file:
<rekado>(import (web server)) (run-server (lambda _ (open-file "ä" "ab")) 'http)
<rekado>after making a request to localhost:8080 you should have an empty ’?’ file.
<RhodiumToad>what encoding is that a-umlaut in, though, when you typed it?
<rekado>UTF-8
<RhodiumToad>what OS are you using?
<rekado>GNU
<rekado>it seems to me that the default port encoding is set to ASCII inside the web server.
<RhodiumToad>look with LC_ALL=C ls -b
<rekado>I see ’?’
<rekado>brb
<RhodiumToad>make sure you're not specifying any -q option to ls anywhere (e.g. via alias)
<RhodiumToad>alternatively do ls | cat -vet
<rekado>ls | cat -vet says: ?$
<rekado>I have no aliases
<rekado>can someone else reproduce my little test case?
<rekado>gotta go for about 2 hrs
<RhodiumToad>just (open-file "ä" "ab") should be a sufficient test
<sirgazil>sneek: later tell rekado: I can't reproduce the problem. I get a file named ä.
<sneek>Got it.
<sirgazil>I'm in GNU too.
<rndd>guys! Assume i want return integer from function, how to do it in scheme?
<sirgazil>Eh! There is no "Procedure" term in the Concept index?!
<sirgazil>rndd: Example: (define (square x) (* x x))
<sirgazil>rndd: Check https://www.gnu.org/software/guile/manual/html_node/About-Procedures.html for more information.
<sirgazil>rndd: Specially https://www.gnu.org/software/guile/manual/html_node/Lambda-Alternatives.html
<rndd>sirgazil: will read, thanks
<sirgazil>The information about creating procedures is one of the parts of the manual I think is complicated for beginners. It starts with lambda instead of (define (name [arg1 [arg2 …]]) body ...)
<mbakke>rekado: I also can't reproduce the umlaut example (using en_US.utf8 locale).
<mbakke>what are good ways to serialize a sexp for transporting over the wire? scm->json-string from guile-json can not work with completely arbitrary sexps.
<chrislck>mbakke: srfi-180
<rekado>RhodiumToad: but it is not sufficient in my case. Just (open-file "ä" "ab") works fine.
<sneek>Welcome back rekado, you have 1 message.
<sneek>rekado, sirgazil says: I can't reproduce the problem. I get a file named ä.
<rekado>It’s just with the web server.
<rekado>(and visiting localhost:8080 with Icecat; haven’t tested any other client yet)
<rekado>visiting with wget I do get a file named “ä”.
<rekado>I wonder if perhaps icecat is running in a different locale…
<mbakke>rekado: I get the umlaut also when using IceCat.
<rekado>hmm, it’s fine with epiphany.
<rekado>icecat runs with LANG set to en_US.UTF-8
<rekado>weird.
<rekado>and it’s fine with a newly started icecat. I wonder if there’s something special about the way the former icecat instance was started.
<rekado>gah, it’s much simpler… I ran my server in a pure Guix environment. This means that LANG was not set in the environment where the server ran. That’s all.
<rekado>thanks everyone for trying to reproduce this!
<sirgazil>:)
<civodul>rekado: ah yes, maybe that was content-type
<civodul>perhaps (guix scripts publish) contains useful hints
<civodul>i always forget what needs to be done
<manumanumanu>civodul: thanks for the feedback! I will try to do it all within a week or two.
<civodul>yw!
<rndd>guys! how to return boolean from function?
<civodul>s/guys/people/ :-)
<civodul>the boolean values are #true and #false
<civodul>so you can return one of these
<civodul>rndd: ↑
<civodul>but note that all Scheme values except #false have truth value
<rndd>civodul: could you show an example? =)
<rekado>rndd: (define (this-is-false) #false)
<rekado>rndd: (this-is-false)
<rekado>(define (this-is-true) 123)
<rekado>(define (this-is-also-true) #true)
<rekado>these procedures both return a truthy value when called.
<rndd>(define (this-is-false) #false)
<rndd>rekado: ok, got it. thank you!
<rndd>hi people!
<rndd>trying to get index of list argument (list-index (= 2) '(1 2 4)) ;; => Wrong type argument: #t.
<rndd>dont really understand what is wrong
<rekado>you need a procedure
<rekado>(= 2) is not a procedure, it’s a value
<rekado>evaluate it in a REPL and you’ll see.
<rekado>so what you’re actually trying to evaluate here is (list-index #t ’(1 2 4))
<rekado>and that’s why you get an error
<rekado>you want a procedure that takes a single value as an argument and compares that with 2.
<rekado>for example: (lambda (value) (= value 2))
<rekado>or after (import (srfi srfi-26)) you can do (cut = <> 2)
<rekado>where <> is a placeholder
<rndd>well, (list-index (lambda (value) (= value 2)) '(1 2 4)) is works =|
<rndd>as i understand (list-index) takes values from list and put it inside procedure
<rndd>well, thank you very much.
<rekado>your understanding is correct
<rekado>procedures that take a value and return either a truthy value or #false are called predicates.
<rekado>in the manual this is often abbreviated as “pred”
<dsmith>Yey! 3.0.0!
<longshi>3.0.1. even!