IRC channel logs

2022-12-27.log

back to list of logs

<whereiseveryone>We have a matrix room for Guix Days moderated by Pjotr Prins in case you want to chat with people that will be involved there in person
<whereiseveryone> https://matrix.to/#/#guix-days:matrix.org
<mfiano>Ah I thought it was going to be like a jitsi thing or something
<mfiano>chat is cool too though
<whereiseveryone>that's just the pre guix days chat room
<whereiseveryone>it will be over BBB
<whereiseveryone> https://meet.nixnet.services/b/jga-txd-v6i-xn9
<whereiseveryone>or meet.nixnet.services
<whereiseveryone>lol
<mfiano>Ah so you are jgart aka jgarte aka all the other accounts I keep blocking on github
<whereiseveryone>ya, that's me
<whereiseveryone>haha
<whereiseveryone>you didn't block irc so hahah
<mfiano>/ignore whereiseveryone
<mfiano>oops, jk :)
<whereiseveryone>lolz
<mfiano>Can someone that has wrapped a C library with Guile before help me dig into these bindings to figure out which version of the API it wraps?
<whereiseveryone>which are the bindings in question?
<mfiano> https://www.gnu.org/software/guile-sdl/
<whereiseveryone>🦗 🦗 🦗
<mfiano>SDL is pretty old. Infact, it is usually called "SDL2" due to the major API change like...15 years ago?
<mfiano>Not to mention any minor version that has significant changes
<mfiano>"SDL" doesn't tell me much...
<whereiseveryone>Maybe try contacting one of the listed authors directly via email. See the git log maybe
<whereiseveryone>for the email
<mfiano>Ok
<mfiano>"This is alpha code (pre 1.0 release), tested with various, but not all, versions of Guile and SDL. It may have bugs, and the interfaces may change from version to version."
<mfiano>Ok then.
<whereiseveryone>> It may have bugs, and the interfaces may change from version to version."
<mfiano>Oh, but Dave saves the day
<mfiano> https://dthompson.us/projects/guile-sdl2.html
<whereiseveryone>There you go, a warm welcome to the Guile community, jk
<whereiseveryone>oh I forgot about that one. I actually had come across that one before
<mfiano>That one was not listed on the .mn site
<whereiseveryone>Ya, I mentioned it may not be up to date ;()
<whereiseveryone>mfiano: That library is used in Dave's game projects
<whereiseveryone>You can check those for examples
<whereiseveryone>if needed
<mfiano>Yeah, now to find out if it supports the ~1 year old floating-point "FRect" struct, or if only the integral "Rect" struct and related functions are wrapped.
<mfiano>If I can't do subpixel placement, it's pretty useless for most things :)
<mfiano>and the answer is "no", but the code looks plenty hackable and extensible.
<mfiano>Ok, so if I side-step my normal GL way of doing things, and add a tiny bit of guile-sdl2 functionality, I can cheat and use Guile for graphics even.
<daviid>mfiano: for 'graphics' you can use chickadee and/or the GNOME stack with g-golf or guile-gi
<daviid>mfiano: then define 'graphics' but you might want to look at aiscm and guile-cv as well ...
<mfiano>Low latency, real-time game engine kind of graphics. I am aware of chickadee, but it is a set of choices that I can't control when developing a low level game engine.
<mfiano>So I will just build off of the underlying guile-sdl2 likely
<daviid>there is anothyer game engine in guile, but i forgot its name
<daviid>lilyp: don't you you have a game engine as well?
<lilyp>daviid: visual novel engine tsukundere
<lilyp>mfiano: fwiw, there is guile-opengl, which is used by chickadee
<mfiano>According to the documentation, guile-opengl only wraps 2.x, which means using the fixed-function pipeline.
<mfiano>"modern gl" didn't really start until around 3.0, finalized in 3.3
<mfiano>where "modern" is like 20 years old now.
<mfiano>In Guile, do symbols with a colon in them hold any significance, or is it only part of the name and a convention to separate the prefix?
<mfiano>Curious if there is any parsing difference or whatnot like there is in CL.
<nckx>Pretty sure it's not magical.
<lloda>yeah : by itself doesn't do anything. Guile keywords are start with #:
<lloda>nearly all of the reader syntax i can think of is #something
<nckx>That's my understanding! # is the portal to magictown.
<mfiano>well I mean the manual has things like procedure passwd:dir
<mfiano>lots of things prefixed with something like that. Just wondering why some things are, and what it means.
<lloda>those are just conventional, like *parameter* or predicate? etc
<mfiano>ok, what does this particular convention mean? I asked some other schemers and they said it's not typically seen.
<mfiano>SO I assume it is a guile convention. But I still don't know why it is only sometimes used or what it even means.
<lloda>it's an adhoc convention. Compare char-set:xxx which are names of charsets vs char-set-xxx which are functions that operate on charsets
<mfiano>I see, thanks!
<lloda>i cannot assure you that it's always used consistently or with the same meaning
<mfiano>Yeah, that's what I gathered by "adhoc". Makes sense...context or comments should explain the difference in each case.
<lloda>yes
<mfiano>Thanks. I learned a bunch today. Trying to come at this by forgetting most of CL and asking dumb questions like this. :)
<plasma41>Where can I find either the source for this Guile Reference Manual cover image or at least a higher resolution version of it? https://www.gnu.org/software/guile/static/base/img/covers/guile-reference.png
<whereiseveryone>plasma41: have you looked in here yet? http://git.savannah.gnu.org/cgit/guile/guile-web.git/tree/designs
<whereiseveryone>maybe check that repo to see if you find it
<a12l>rekado: Thanks for the function defs. yesterday!
<plasma41>whereiseveryone: That's exactly what I was after, thank you.
<whereiseveryone>no probs glad that helped
<a12l>I'm looking into the `cut` function, and I'm wondering what a "slot" are? https://www.gnu.org/software/guile/manual/guile.html#SRFI_002d26
<whereiseveryone>a12l: that terminology is a bit confusing and I also think that the examples in that doc are not the best
<whereiseveryone>a12l: maybe we should improve them?
<whereiseveryone>a slot is just a placeholder for where the object will be inserted
<whereiseveryone>using srfi-26 is a bit like doing currying
<whereiseveryone>it is an alternative way to implement the basic concept of what you do when you curry a function
<a12l>Is it a synonym for parameters? Or is `cut` a special form, and we have other terms for "arguments" to those?
<whereiseveryone>the srfi-26 spec explains in that way also
<whereiseveryone>> Notation for Specializing Parameters without Currying
<whereiseveryone> https://srfi.schemers.org/srfi-26/
<a12l>Thanks, I'll read that
<a12l>I thought Scheme did partial application automatically
<a12l>Guess that I'm still to used to Haskell's behavior when writing Scheme.
<whereiseveryone>a12l: here's a nice example of using cut from guix: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/bioinformatics.scm#n6761
<whereiseveryone>install-file is a procedure that takes a file name to install as its first argument
<whereiseveryone>in this example, we loop over all the cpp header files in the current directory and install each one
<whereiseveryone>the <> symbol is syntax for where to place the cpp header file argument
<whereiseveryone>So you end up with a call to install file like so: (install-file <> ...) becomes (install-file foo.hpp include)
<whereiseveryone>in the example, include is a string variable defined in the above let* block that represents the file path that we are installing the cpp header file into
<whereiseveryone>HTH
<whereiseveryone>does anyone have a good way of explaining where outputs comes from on this line: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/bioinformatics.scm#n6753
<whereiseveryone>a lucid TLDR
<whereiseveryone>that outputs is pretty abstracted out from that code context in the greater system
<a12l>whereiseveryone: Thanks a lot for your explanation! Really helped me :)
<whereiseveryone>Great! glad to hear
<whereiseveryone>I would look for other code examples of cut and cute that are not the guile manual
<whereiseveryone>until we include better example there
<whereiseveryone>s/examples ther efor it/
<whereiseveryone>s/examples there for it/
<whereiseveryone>otherwise you might get unnecessarily confused
<whereiseveryone>srfi-26 in practice is a way simpler concept to understand than how it is being explained in the guile docs
<whereiseveryone>I might try to find the time to rewrite it if people are open to a patch for that?
<whereiseveryone>I also think that some of the info from this blog post should be consolidated into the goops docs: https://dthompson.us/issues-with-object-oriented-programming-in-guile.html
<whereiseveryone>daviid: mfiano WDYT
<whereiseveryone>Should the guile docs also mention known foot guns or bugs in certain systems that are not complete? For example, goops?
<singpolyma>What about goops is not complete?
<whereiseveryone>singpolyma: Read daviid's blog post for all the details on what is not complete or currently buggy: https://dthompson.us/issues-with-object-oriented-programming-in-guile.html
<whereiseveryone>It's from October 05, 2022 so relatively recent information unless you're very familiar with the goops code from personal experience hacking on it in the past
<a12l>I'm trying to define something similar in Guile as the Haskell function I've defined here: https://gist.github.com/a12l/b926293cc20db0e4eb5dc86c866fdc18
<singpolyma>Oh I see, using goops for class-style oop with inheritance
<a12l>What I can't figure out is how to express the pattern to match "the first letter is either G, C, T, or A"
<whereiseveryone>a12l: That program currently has another bug though right?
<whereiseveryone>It loops infinitely for me
<whereiseveryone>I should have enabled oom-service-type in guix system
<a12l>Most probably, I'm very much in the beginning of learning Guile :P
<whereiseveryone>does it hang for you?
<a12l>I actually haven't tested to run it, because I know it's not finished
<a12l>Can test it
<whereiseveryone>oh ok
<a12l>Get an compiler error when I try to run it
<whereiseveryone>it currently infinitely loops
<whereiseveryone>i got an oom error
<whereiseveryone>so maybe first fix that in the code
<whereiseveryone>it infinitely loops I think because when you recurse with the string you also always (string-append "C" ...
<whereiseveryone>so you never get the empty string if you pass in one of the valid strings that you specified
<whereiseveryone>a12l: does that make sense?
<singpolyma>whereiseveryone: isn't that the question though? They want to know how to get the first char off the string
<singpolyma>I am under obligation to point out that characters don't exist and you can't loop over them, but otherwise I think that's the question
<a12l>It's partially that, and but I'm also bit supprised
<whereiseveryone>Why are you surprised?
<a12l>Because I'm recursively calling `dna->rna` with the tail of the string?
<whereiseveryone>You're calling it with the head of the string from what I see
<whereiseveryone>a12l: Can you describe in prose what your algo should do?
<whereiseveryone>mfiano: has anyone ever tried to implement alexandria in scheme or does it make sense to implement any part of alex given that it is meant to supplement the CL spec?
<whereiseveryone>singpolyma: can you unpack why characters don't exist?
<lilyp>a12l: how about a string-fold instead?
<lilyp>or even better string-map?
<whereiseveryone>I can get behind why a C programmer might think that strings don't exist...
<singpolyma>whereiseveryone: Unicode has several different things people call "characters" but there is no definition for the word itself
<whereiseveryone>lilyp: I'm having too much fun with daikichi, espeak, and mcron
<singpolyma>Some people mean code points, some mean grapheme clusters, neither is a unit you want to operate in often but both are things people often think they need.
<lilyp>also, it loops infinitely because your code is not tail-recursive – that means it actually needs a stack
<whereiseveryone>singpolyma: got it! thnx
<lilyp>that plus you're always just taking the first element, i.e. ("ACG" → "A" → "A" → ...)
<a12l>whereiseveryone: Let `dna` be a string consisting of the letters `A`, `C`, `G`, and `T`; or be the empty string. If it's the empty string the function should return the empty string. Otherwise it should return the "matching" letter for the letter (`U` for `A`, `G` for `C`, `C` for `G`, and `A` for `T`) and the result from running `dna->rna` over the rest of `dna`.
<a12l>Hope I expressed it clearly enough :)
<a12l>lilyp: What would I need to do to make it tail recursive?
<whereiseveryone>a12l can you give 2-3 example inputs and outputs
<whereiseveryone>for my own curiosity
<whereiseveryone>a12l: you wouldn't be able to have that string-append is one thing
<whereiseveryone>the way it currently is
<whereiseveryone>you'd have to move it
<whereiseveryone>that's maybe one thing
<a12l>whereiseveryone: https://gist.github.com/a12l/b926293cc20db0e4eb5dc86c866fdc18#file-test-scm
<whereiseveryone>oh got you now
<a12l>whereiseveryone: I've written that code pretty much as a "translation" of the haskell function I would have written, but I'm not sure if that's possible in Scheme.
<whereiseveryone>it's a mapping
<a12l>string-map seems to be very fitting.
<lilyp> https://paste.gnome.org/EdsmRdL2J
<whereiseveryone>and it's not a bijection
<whereiseveryone>lilyp: will that cover the inverse mapping though?
<whereiseveryone>C also needs to map to G
<lilyp>it's not bijective, but C should map to G ;)
<whereiseveryone>oh ya
<whereiseveryone>my bad
<whereiseveryone>read it again ;()
<a12l>Thanks people!
<a12l>Seems that I should use string-map for this.
<whereiseveryone>a12l: yup there's your answer
<a12l>But would it have been possible using pattern matching as I thought?
<a12l>originally
<lilyp>sure
<a12l>Or is it tail recursion that stops it from working (in a nice way)?
<a12l>lilyp: Could you please write an example solution, so I can see what I did wrong?
<lilyp> https://paste.gnome.org/R5Wc7RBQ7 not tail-recursive, but fixes your bugs
<a12l>Thanks! So "pattern matching" in Scheme works as if pattern matching and guards in Haskell would have one syntax for it.
<lilyp>yep, provided that you can formulate your guard as a pattern
<daviid>whereiseveryone: the blog is written by dthompson, not me :) - no i don't think its content should go in the manual - i don't think goops current state is a 'foot gun shot', i use goops extensively daily and still have my feet intact :)
<daviid>i'd made a few coments if i had time, but a quick one to correct this: 'Generics cannot be merged outside of a module' - that is incorrect, yes they can
<daviid>as shown here - https://git.savannah.gnu.org/cgit/g-golf.git/tree/examples/gtk-4/peg-solitaire.scm - line 33 to 37: those line _must_ preceed any import/use-modules statment that would indeed require the settings ... ofc but i'd rather write it :)
<daviid>also, we have a define-method* 'out there', i should actualy add it to gule-lib, but let me paste
<daviid>here https://git.savannah.nongnu.org/cgit/grip.git/tree/grip/goops.scm#n62
<daviid>please read the comment lines 26 - 32, which explains that this code was written by Mark H Weaver
<daviid>fwiw, gauche (which also based its implementation on stklos) got its slot inheritance right, in guile, it is a deliberate design (bug in my oinion, i agree with dthompson) it used to be properly implemented, but was changed somewhere arounf guile 2.0 or 2.2 i don't rember - i mentioned the bug, i was told it was a feature
<daviid>iiuc, the main reason behind the 'no proper slot inheritance compsition' choice is speed - some very important improvments have been made by wingo in the last 10 to ..y, and 'proper slot inheritance composition' would break those improvments
<daviid>it would be nice to 'keep the spead' for class-direct-slots and allow, with some slot access speed degradation, proper slot inheritance composition though - not sure it is possible, but i am definitely sure it would not easy to implement, otherwise wingo would have done it
<daviid>i think we all wish to have before/after/around method qualifiers, not easy to patch those either though - they are not in stklos, and so never were part of the design - patching those is a bit like patching a house after it's been constructed, to make a change in the foundation of the building - not impossible, but difficult ...
<daviid>there is another not mentioned (in dthompson's blog post) diff with the clos protocol, which is far more dangerous imo, which is that define-generic does not raise an exception if redefining an existing generic. unlike the procol asks for, in goops, it silently create a new generic and throw away all previously defined and added methods - terrible
<daviid>i think patching to have doc string would probably not be that difficult - not offering to do this, i have no real interest (nor time) but i understand one would wish goops had those ...
<singpolyma>Why should that be part of goops vs just all producers?
<singpolyma>...procedures