IRC channel logs


back to list of logs

<lloda>> guile-cairo 1.11.1 is out
<RhodiumToad>tested build with the released file, builds ok
<dsmith>The bot remembers by the "metaphone" of the nick. I supposed it's for sloppy/fuzzy matching.
<dsmith>Except when addressing the bot. That used to be by metaphone also, but I've fixed that.
<RhodiumToad>metaphone is a bit, um, loose
<dsmith>(seen used to match sneek)
<RhodiumToad>(though I suppose it could have been worse, like soundex)
<dsmith>The metaphone for both ends up being "sn"
<RhodiumToad>metaphone is definitely too loose for nicks without arranging to store multiple nicks per metaphone
<buffergn0me>Does anyone have tips for how to handle the meta switch with a relative guile path so that Emacs opens the script file in Scheme major mode?
<buffergn0me>Specifically, I am doing #!/bin/sh
<buffergn0me>exec guile --no-auto-compile -s "$0"
<buffergn0me>At the top of the script file
<ryanprior>How do I interpolate a string? Like (let ((place "world")) (interpolate "Hello, {place}!"))
<buffergn0me>One answer to my earlier question: # -*-Scheme-*- as the second line after #!/bin/sh
<buffergn0me>Would be nice to do this by file extension instead, but I am not sure if there is a convenient mechanism for modifying the major mode search order for this case
***catonano_ is now known as catonano
<alextee[m]>ryanprior: i'd use (string-append) or format
<alextee[m]>not sure if there's a formant variant that takes named arguments
***jonsger1 is now known as jonsger
<ryanprior>(string-append "first " a " then " b " and then finally " c.")
<ryanprior>(interpolate "first {a} then {b} and then finally {c}.")
<ryanprior>The second one looks so much more obviously correct to me, whereas I strain to scan the first one to make sure all my spaces and quotes are correct.
<ryanprior>Can I write a reader macro to do that?
<lloda>You can use a regular macro to pick the names of the variables, the rest is just parsing the string.
<ryanprior>Cool, I would like to work on that. I have not grasped the API of the Guile macro system yet despite reading the manual and looking at a dozen examples. In particular the examples I've found (in Guix and the Guile manual) have been either simplistic and don't do much, or inscrutible such that I don't really understand what they do or how.
<ryanprior>So if you know anybody who writes cool macros that I should definitely learn from, I would love links.
<lloda>i've written some macros, but i'm far from an expert
<ryanprior>Otherwise my plan is to work my way through the codebases of some existing guile repos (ice-9 things maybe?) and search for better examples.
<lloda>i've read a good chunk of
<lloda>i think it's good
<lloda>bear in mind it's for racket, so not all of what he talks about is available in Guile
<lloda>then there's tspl4 by Dybvig
<lloda>it's more of a reference
<lloda>there are a couple of articles that cover syntax-rules only, not syntax-case
<lloda>syntax-rules for the merely eccentric and for the mildly insane, iirc
<lloda>those are worth a read too
<dsmith>sneek: macros?
<sneek>I could be wrong, but macros is
<ryanprior>Cool I will give those a read lloda & dsmith thank you!
<pinoaffe>hi everybody! (string->symbol "17f658ff") fails with $1 = ice-9/boot-9.scm:1669:16: In procedure raise-exception: In procedure string->number: Value out of range: 658, is this a bug?
<daviid>tohoyn: I pushed a series of patches to support GList/GSList 'inout, 'out arguments and GSList 'in arguments - so now you may use gtk-radio-menu-item-get-group and even gtk-radio-menu-item-set-group, for example ... although wrt the later, as mentined earlier, gtk-radio-menu-item-join-group is 'the recommended way' - note that you may (also) create instances using (make <gtk-radio-menu-item> #:label "Item xx), then
<daviid>gtk-radio-menu-item-join-group ...
<daviid>str1ngs: ^^ fwiw :)
<daviid>str1ngs: I've not implemented anything yet wrt callback support, I did a bit of thinking about it, but 'nothing yet'
<daviid>str1ngs: now, I'm thinking to first work to offer proper support for interfaces (so they become goops classes, inheritable by those implementing 'their interface' ...), then work to provide the long waited 'short method names', then I'll get back to the callback support ...
<daviid>fwiw, here a slightly better hello-world example, which uses a <gtk-alignment> and proper gtk-box-pack-start expand fill padding settings, so when the user changes the window size things a kept 'nice and pretty' :) - - it only lacks short method names, coming ...
***apteryx is now known as Guest96237
***apteryx_ is now known as apteryx
<str1ngs>daviid: thanks for the update. generally I just use gtk-box-pack-start myself.
<janneke>hey wingo
<rgherdt>Neo, onde tu estavas?!
<rgherdt>sorry, wrong chat
<RhodiumToad>pinoaffe: interestingly, the same error occurs with entering #{17f658ff}# literally
<RhodiumToad>or to be more precise, it's produced by trying to _output_ that symbol
<RhodiumToad>in fact (symbol? (string->symbol "17f658ff")) returns #t with no error as one would expect
<RhodiumToad>so it's a bug in the code that decides whether a symbol needs to be printed with extended read syntax or not
<RhodiumToad>if (scm_is_true (scm_i_string_to_number (scm_symbol_to_string (sym), 10))) return 1;
<RhodiumToad>and the string_to_number throws because it has the form of a number with exponent but the exponent is too large
<dsmith>RhodiumToad: Sweet!
<dsmith>Surprising to me it's messing about with a symbol as a number. Should be just a sequence of chars, right? Oh! It's needing to know if it should do the #{..}#.
<RhodiumToad>though something else isn't right here, I think
<RhodiumToad>a lot of things seem to get #{...}# that don't appear to need them
<RhodiumToad>so the check for a number seems to be redundant as it stands - it does that check if the first character in the symbol is +, -, or ascii 0-9
<RhodiumToad>but none of those appear to be in the class of valid initial characters that it checks later
<RhodiumToad>is there a handy function somewhere to say what unicode classes a character is in?
<RhodiumToad>ah, char-general-category seems to be the thing
<RhodiumToad>ah. it matters for symbols that begin with + or -
<RhodiumToad>since symbols can start with those too
<RhodiumToad>er, numbers
<RhodiumToad>so #{-10z}# prints as just -10z because that's not a number, while #{10z}# prints as #{10z}# because it starts with a category Nd character which is not allowed to be first in a symbol
<RhodiumToad>so what that check actually needs is a function that says whether a string has the syntactic form of a number, regardless of whether it can be converted to a number or not
<pinoaffe>RhodiumToad: ah okay, thanks for taking a look!
<RhodiumToad>workaround, avoid printing your strangely-named symbols :-)
<pinoaffe>I'm generating a lot of uuids and printing them as symbols, so this happens every now and then
<RhodiumToad>hm, that sounds like it could be a pain
<pinoaffe>yeah, I might try and write a function to detect whether a uuid is going to trigger this and just generate a new one in that case
<RhodiumToad>I guess you don't want to change the format of your uuid symbols
<pinoaffe>I'm working with an external file format (the librepcb files), and I don't think they'll lightly make such a massive change in their file format :)
<pinoaffe>I guess I could also write a simple printing / writing function, that might be easier
<RhodiumToad>arrange to always print your symbols as strings instead?
<pinoaffe>yup, that should do the trick
<dsmith-work>Morning Greetings, Guilers
<mwette>morning here, good morning
<pinoaffe>RhodiumToad: I ended up writing my own, very minimal, sexp-printer:
<lloda>arch = os.popen('../config/config.guess').read()
<lloda>bad paste my bad :-(
<RhodiumToad>I guess someone should write up a bug report for the symbol thing?
<RhodiumToad>bah. it was reported in 2016
<dsmith-work>RhodiumToad: Do you have an idea for a fix?
<sneek>dsmith-work, you have 1 message!
<sneek>dsmith-work, chrislck says: {appropriate-time} greetings to you too!
<pinoaffe>RhodiumToad: wew, that's old
<RhodiumToad>the bug is caused by confusion between "has the syntax of a number" and "can be converted to a number", so maybe those two concepts need to be split apart somehow?
<sneek>Welcome back RhodiumToad, you have 1 message!
<sneek>RhodiumToad, chrislck says: you are very helpful
<chrislck>sneek: ok that's enough
<chrislck>a looong time ago gnucash was a guile app, very scriptable. soon, gnucash will run reports from commandline.
<RhodiumToad>I guess the question is how hard should display of a symbol try to avoid using #{...}# ?
<dsmith-work>ISTR fixing bug in gnucash is what drew wingo into guile
<RhodiumToad>there are currently cases like (display '10z) where a symbol read without #{..}# is nonetheless printed with them
<dsmith-work>Ok this is interesting:
<dsmith-work>scheme@(guile-user)> (string->symbol "}#")
<dsmith-work>$1 = #{\x7d;#}#
<RhodiumToad>the tricky case is (display '-10z)
<chrislck>I think wingo wanted a report which tells him how much he earned per DOW
<RhodiumToad>if changing the behavior of (display '-10z) to output #{-10z}# is acceptable, then it would be sufficient to simply change the code to look for an initial + or - followed by a digit or .
<RhodiumToad>(I think)
<dsmith-work>Racket uses '|...| instead of '#{...}#
<dsmith-work>Is there anything standard?
<RhodiumToad>|...| is r7rs, no?
<RhodiumToad>guile has an option for it
<RhodiumToad>(options for reading and printing, that is)
<RhodiumToad>but that doesn't avoid this problem
***rekado_ is now known as rekado
***cantstanya is now known as frank
***frank is now known as cantstanya
<winny>hello, what is the return value of the display procedure?
<winny>Working on glue to evaluate an expression and do the right thing when printing it back to IRC, as such no value should be echoed back as "(No value)"
<dsmith-work>Unspecified. Same thing that (if #f #f) would return.
<reepca>does 'write' ever produce newlines?
<winny>as a solution I found (display (call-with-values thunk (lambda args (cond ((null? args) "(No value)") ((= 1 (length args)) (car args)) (else (cons 'values args)))))) works
<winny>e.g. no args passed to the call-with-values receiver means something like display was called
<winny>is this the best way?
<dsmith-work>scheme@(guile-user)> (eq? (if #f #f) (display ""))
<dsmith-work>$1 = #t
<RhodiumToad>I wouldn't really expect that to be portable
<winny>indeed, i'm asking here because i'm writing for guile ;)
<RhodiumToad>right. so what seems to happen in guile is that display returns no values
<RhodiumToad>so your call-with-values is probably the right approach
<RhodiumToad>you could probably improve on it using case-lambda
<RhodiumToad>hm. no. it's not working for me
<RhodiumToad>(lambda () (display 1)) is returning one value which is #<unspecified>
<RhodiumToad>(unspecified? x) seems to be the way to go
<RhodiumToad>(call-with-values thunk (case-lambda (() "(No value)") ((a) (if (unspecified? a) "(unspecified)" a)) (rest (cons 'values rest))))