IRC channel logs

2020-03-16.log

back to list of logs

***catonano_ is now known as catonano
<regtur>civodul: did you receive my copyright assignment in good order?
<regtur>assignment request that is
<civodul>hi regtur!
<civodul>yes, we received the request and the message from the copyright clerk
<civodul>i have to comment on your latest patch
<wingo>o/
<janneke>\o
<chrislck>o\
<lloda>//o
<nerdypepper>\\o
<regtur>civodul: comment to whom?
<civodul>regtur: to you i guess :-)
<civodul>maybe there's not much left to discuss though
<regtur>just let me know if there is
<civodul>sure
<regtur>thank you
***sneek_ is now known as sneek
<dsmith-work>UGT Greetings, Guilers
<wingo>rerro
***regtur is now known as regtur_
***regtur_ is now known as regtur
<spk121>ooh, compiling Guile with -Wshadow reveals some interesting possible sources of confusion, but probably no bugs as far as I can tell
***roptat_ is now known as roptat
<civodul>spk121: yeah -Wshadow was prompted by actual confusion in Guix :-)
<tohoyn>in Gtk the constructors usually have return type GtkWidget. it would be could to have constructors having type of the constructed object as a result type.
<tohoyn>s/could/good/g
<tohoyn>the introspection library (Golf) has a flag for constructors
<tohoyn>but how to obtain the type to be constructed?
<daviid>tohoyn: (gtk-window-new 'toplevel) -| #<<gtk-window> 556143c74aa0>
<daviid>so does (make <gtk-window>)
<tohoyn>daviid: gtk-label-new returns <gtk-widget>
<tohoyn>daviid: AFAIK this is an usual convention in Gtk
<tohoyn>daviid: of course the dynamic type of the object is the type to be constructed
<daviid>(gtk-label-new "Bluefox") -| #<<gtk-label> 556143ca0940>
<tohoyn>daviid: yes
<tohoyn>daviid: I'm developing a programming language with static type declarations
<tohoyn>daviid: so it would be good if I could declare the return type of gtk-label-new to be <gtk-label>
<tohoyn>daviid: or have a constructor with different name for this
<tohoyn>daviid: of course it is possible to define this kind of constructors manually
<daviid>tohoyn: the 'type' is <gtk-label>
<mfg>Hi guile, i have a question regarding the following stackoverflow question: https://stackoverflow.com/questions/48559030/flatten-top-level-sublists-in-scheme
<mfg>the first answer gives an outline on how to solve that problem, but i seem to have an off-by-one error somewhere.
<mfg> https://dpaste.org/D78r is what i thought would be correct, but i have (() 1 2 3 (((4 . 3))) (5 (6)) . 7) as an result for the example given in the answer...
<mfg>so what did i do wrong here>
<mfg>?
<RhodiumToad>you want to flatten just one level?
<mfg>exactly
<mfg>well at least i think i want that, i'm not a schemer, so there might be a better solution for my problem... i'm trying to get this:
<mfg>("cc_library_headers"
<mfg> (("name" "libcutils_headers")
<mfg> (("vendor_available" #t)
<mfg> (("recovery_available" #t)
<mfg> (("host_supported" #t)
<mfg> (("export_include_dirs" ("include"))))))))
<mfg>into one list, but flattening destroys the sublists which i don't want
<RhodiumToad>why is that adding a nesting level each time?
<mfg>it is generated by a parser and the grammar rule is right recursive
<RhodiumToad>hm
<RhodiumToad>and the result you want is ("cc_library_headers" ("name" "libcutils_headers") ("vendor_available" #t) ...) ?
<mfg>yes, that is my goal
<RhodiumToad>or in short, (1 (2 (3 (4 (5))))) becomes (1 2 3 4 5)
<mfg>with numbers it should look that way yes
<RhodiumToad>how about (let loop ((lst lst)) (cond ((and (pair? lst) (pair? (cdr lst))) (cons (car lst) (loop (cadr lst)))) (#t lst)))
<RhodiumToad>or the equivalent with (match)
<RhodiumToad>or
<RhodiumToad>(define (unnest-right lst) (match lst ((h t) (cons h (unnest-right t))) (x x)))
<RhodiumToad>I think your question was not well stated
<mfg>what is your difficulty with my question? i'll try to clarify :)
<RhodiumToad>the question you asked didn't seem to have anything to do with the example you just showed above
<RhodiumToad>the code I gave is for the example above, not for the original question
<mfg>the original question arose, because i tried to solve what i showed in the example. i thought i could recursively take the car of such a nested list and flatten it one level after each recursion step
<mfg>but i didn't get the flattening right
<mfg>i don't even know about match :D, i have seen it in code but i never looked it up (it's the first time i'm using guile)
<RhodiumToad>needs (use-module ((ice-9 match)))
<RhodiumToad>er, use-modules
<mfg>i noticed that, it seems to work. that means i really have to read the documentation about it :D
<mfg>thanks for your help :)