IRC channel logs

2019-09-01.log

back to list of logs

<jcowan>Tirifto: Let me look at Art Gleckler's list of which Schemes support which SRFIs.
<jcowan>Chicken, Guile, Gambit, Kawa, STklos. Not much portability, really.
<Tirifto>jcowan: Eh, better than '(), I guess! :D
<jcowan>I once wrote a whole Scheme program with () where I should have used '(), because at that time Chez would accept either. When I ported the code to Chicken, I got lots of complaints, so I replaced () with '() throughout, but of course (lambda '() ...) was a problem too.
<daviid>str1ngs: just pushed a very important patch, which fixes the construct and construct-only g-properties - I rewrote g-inst-construct so it may use g-object-new-with-properties
<daviid>so, this now works: (make <gtk-window> #:type 'popup)
<apteryx>is there anything like enums in Guile/Scheme?
<spk121>apteryx: there is the (rnrs enums) is Guile itself, but, it is pretty limited
<apteryx>spk121: will check it out, thanks
<apteryx>looks good!
<apteryx>how can I recursively concatenate all elements of a list such as: '("iburst" ("version" 2) "debug") -> "iburst version 2 debug" ?
<chrislck>apteryx: this is flatten, a common scheme-intro task
<chrislck>in guile it's so tempting to constantly yak-shaving
<apteryx>There's this thing called context-flatten from PEG
<apteryx>but it seems designed for a particular use case
<apteryx>guess I'll shave a yak
<apteryx>;-)
<chrislck>ugh, peg
<chrislck> https://stackoverflow.com/questions/8387583/writing-flatten-method-in-scheme take your pick
<chrislck> https://stackoverflow.com/questions/7313563/flatten-a-list-using-only-the-forms-in-the-little-schemer/7324493#7324493 is the most yak-shaved apparently
<apteryx>neat, thanks!
<chrislck>now, try rewrite it in 1 named-let :)
<g_bor>Hello gentle people!
<g_bor>I might be misunderstanding something, but it seems to me that the count argument of guile srfi-64 test-begin from does not conform to the specification with respect to nested test groups.
<g_bor>If I understand correctly a nested test group should count as one in the nesting group.
<chrislck>apteryx: (define (flatten1 . lst) (reverse! (let lp ((e lst) (res '())) (if (pair? e) (fold lp res e) (cons e res)))))
<apteryx>it's a bit mind binding to have the fold recurse the function where it's called, but I think I get it
<apteryx>it goes down anything that are lists recursively and cons the items
<chrislck>apteryx: even more mindboggling is that it already has bug: replace pair? with list? to handle nulls correctly
<apteryx>the variable names of the SO example don't help as well
<apteryx>lst becomes x and the result is named lst
<apteryx>isn't pair? ok to handle '()? It'll just get consed as is
<chrislck>no: the-little-schemer will teach this
<chrislck>pair? only returns #t for a non-empty list
<apteryx>yes; isn't that OK? there's no need to call fold on '()
<apteryx>or i'm missing something
<apteryx>ah! If the input is '(), it returns (list '()), which is not expected. This is the bug, right?
<chrislck>#t
<apteryx>thanks a lot!
<apteryx>surprisingly hard
<apteryx>maybe there should be a flatten in srfi-1
*chrislck finds writing these algorithms the most rewarding of scheme
<chrislck>here's a prior work to manipulate nested-association-lists: https://github.com/Gnucash/gnucash/blob/master/gnucash/report/html-chart.scm#L29
<chrislck>for cases whereby we want to target and modify a leaf node such as '(education school) in '((age . 25) (education . ((city . london) (school . lse))))
<apteryx>interesting!
<apteryx>I've experimented a bit with (rnrs enums), and I'm not sure I understand how to use the enum predicate it defines, e.g.: (define-enumeration my-enum (a b c) make-my-enum), then testing the predicate: (my-enum a) works, but (my-enum 'a) fails.
<apteryx>suppose that this enum is to be used in a record, provided by the user. What would they need to enter as input, given that 'a doesn't work, and just a is undefined?
<apteryx>maybe they need to do (make-my-enum a) ?
<apteryx>nope... (my-enum (make-my-enum a)) fails
<apteryx>oh, maybe: (enum-set-member? symbol enum-set)
<jcowan>apteryx: The trouble is that an enumeration type knows what symbols it has, but a symbol knows nothing about enumeration types: the only property a symbol has is its name.
<apteryx>jcowan: yes, it seems what I want is a "set" rather than a type, as can be obtained with (make-enumeration '(a b c d)
<apteryx>)
<apteryx>then I can use `enum-set-member? using a symbol on it
<jcowan>Yes, I forgot that R6RS conflates sets and types.
<jcowan>The whole thing is IMO badly designed. I have a much better design IMAO, but not an implementation yet.
<jcowan>It uses unique objects, not symbols, and they have four properties: a name (symbol), an ordinal (0 to n - 1 for an n-element enum type), the type object itself, and an arbitrary value.
<jcowan>A set is a separate kind of object from a type, basically a bitvector showing which members of the type are in the set.
<jcowan>details at https://bitbucket.org/cowan/r7rs-wg1-infra/src/default/EnumsCowan.md
<apteryx>glad to know it might make it into r7rs? :-)
<apteryx>eh, I'm confused, r7rs appears to have been completed in 2013 ;-)
<str1ngs>sneek: later tell daviid. That is a nice addition will test this out. Also regards to you mentioning signal's the other day. Signals would be the only thing that blocks me from porting completely to scheme. However it's not a rush right now. Since I connect my signals during GObject initialization, basically in C. So when you get around to signals is when you get around to it.
<sneek>Okay.
<rain1>hello
<nly>hi
<str1ngs>sneek: later tell daviid. I'm noticing a problem with when constructing with a property. I'm currently getting "Wrong type (expecting ~A): ~S" ("exact integer" #f). I working on creating simple example of fails. Right now the constructor that is failing in non trivial in that it inherits two other classes. But if that error rings a bell let me know. Other wise I'll get back to with a more simplified case that is failing with this error
<sneek>Got it.
<wingo>woo finally able to match racket and chez for mbrot benchmark
<Tirifto>Congrats! :D
<nly>yay
<wingo>i think to catch up on "ray" we would need to optimize inexact->exact
<wingo>and maybe have more global type inference :P dunno
<wingo>davexunit: just landed a significant improvement for exact->inexact or otherwise converting s64 to f64
<civodul>wingo: yay!
<rain1>how does unboxing work in scheme? like across procedure boundaries
<daviid>heya
<sneek>daviid, you have 2 messages.
<sneek>daviid, str1ngs says: That is a nice addition will test this out. Also regards to you mentioning signal's the other day. Signals would be the only thing that blocks me from porting completely to scheme. However it's not a rush right now. Since I connect my signals during GObject initialization, basically in C. So when you get around to signals is when you get around to it.
<sneek>daviid, str1ngs says: I'm noticing a problem with when constructing with a property. I'm currently getting "Wrong type (expecting ~A): ~S" ("exact integer" #f). I working on creating simple example of fails. Right now the constructor that is failing in non trivial in that it inherits two other classes. But if that error rings a bell let me know. Other wise I'll get back to with a more simplified case that is failing with this error
<daviid>wingo: great!
<wingo>rain1: mostly doesn't -- you need inlining to allow guile to unbox
<wingo>inlining or contification or similar things
<daviid>str1ngs: the backtrace should tell you in whch part of the code it fails, but when you have an example i can use to reproduce, let m know
<str1ngs>daviid: I agree an example will be better. I'll try go put something together today or tomorrow for you.
<daviid>ok
<daviid>does it say on which property it fails, and if yes, does it work if you just make a instance of that class and that property?
<str1ngs>daviid: I thought maybe it was <webkit-web-view> but that seems to be okay. but it could have something to do with the fact I'm inheriting WebKitWebView as NomadWebView which makes this non trivial. So when I have more time, I'll simplify it and see if I can isolate it better.
<daviid>str1ngs: is this class having 'none g-property' slots? maybe there is missing 'bit' wrt that in my patch