IRC channel logs

2020-04-29.log

back to list of logs

<alextee[m]>i want to call a proc on each element in a list, and i also want to know the index of the element in that proc. is there a function that does this?
<alextee[m]>or somehow pass both the element and the list in the proc, so i can calculate the index myself
<alextee[m]>maybe a named let would fit here
<RhodiumToad>do you need to return a constructed result?
<RhodiumToad>you could count the element index in a fold
<alextee[m]>no i just need to display it
<alextee[m]>oh fold looks like it would work here, thanks
<RhodiumToad>(fold (lambda (elem idx) (do-stuff elem) (1+ idx)) 0 mylist)
<RhodiumToad>or something of that ilk
<alextee[m]>thanks!
<RhodiumToad>obviously you could do it with a named-let but then you can do anything with a named-let
<daviid>I fixed/enhanced g-golf for (a) 'interface properties and (b) list-store/tree-model set/get value for 'object column type
<daviid>both fix illustrated in this example - https://paste.debian.net/1143648/ - line 37 for (a) and lines 36, 62, 65 67, 68 for (b)
***wxie1 is now known as wxie
<rlb>Is there a "Local Varables" setting to select the scheme "implementation" for scheme-mode? i.e. chicken vs guile vs...?
<rlb>(wrt emacs)
<rlb>s/Varables/Variables/
<dsmith>rlb: I don't think so for bare scheme mode. But probably is for geiser.
<rlb>maybe that's what I'm seeing?
<rlb>(in the mode line)
<rlb>normally says Guile when you have #!/...guile, but doesn't if you need some mess that execs guile further down in the #!...!# block comment, and so I was trying to fix that.
<dsmith>rlb: geiser-guile--guess in geiser-guile.el
<rlb>dsmith: ahh, thanks. I'll take a look.
<str1ngs>I think the guile mode comes from geiser
<str1ngs>daviid: looks good daviid thanks.
<dsmith>rlb: file-local-variable: geiser-scheme-implementation
<dsmith>rlb: Thanks for the reminder. I was just wanting this the othe day.
<rlb>Hah, your welcome? (Thanks.)
<rlb>s/your/you're/
<dsmith> https://www.nongnu.org/geiser/geiser_4.html#How-Geiser-associates-a-REPL-to-your-Scheme-buffer
<mwette>xb
<wingo>wow nice post on type inference in cps!!! http://seanplynch.com/blog/understanding-the-guile-type-inferencer.html
<alextee[m]>which module provides string-replace-substring? the manual doesn't mention
<alextee[m]>oh it does nvm
<alextee[m]>(use-modules (ice-9 string-fun))
<alextee[m]>i still get "In procedure module-lookup: Unbound variable: string-replace-substring"
<RhodiumToad>where is it in the manual?
<alextee[m]>RhodiumToad: 6.6.5.12 Miscellaneous String Operations
<RhodiumToad>not seeing it
<RhodiumToad>in which version?
<alextee[m]>ah that's my local copy, maybe it's outdated
<alextee[m]>RhodiumToad: it's there
<RhodiumToad>for which version?
<alextee[m]>6.6.5.12 Miscellaneous String Operations last part
<alextee[m]> https://www.gnu.org/software/guile/manual/guile.html#Miscellaneous-String-Operations
<alextee[m]>im using guile 2.2.7 btw, maybe this is for guile 3?
<RhodiumToad>yes
<RhodiumToad>it's new in guile3
<RhodiumToad>or at least newer than 2.2.7
<alextee[m]>ah i see. i'll copy this then https://lists.gnu.org/archive/html/guile-devel/2013-09/msg00029.html
<chrislck>this is a function with lots of history
*alextee[m] is writing a gsettings schema generator in guile: https://paste.debian.net/1143702/
<alextee[m]>result so far: https://paste.debian.net/1143703/
<alextee[m]>so much better than editing xml!
<chrislck>why not use sxml->xml ?
<alextee[m]>oh didnt know about that. not sure how that would work
<alextee[m]>looks pretty complicated
<rekado>alextee[m]: but it isn’t!
<rekado>it lets you convert an S-expression representation to valid XML
<rekado>(sxml->xml '(enum (@ (id "org.zrythm.Zrythm.audio-backend-enum")) (value (@ (nick "none") (value "0")))))
<alextee[m]>oh! great! let me try that
<rekado>@ introduces attribute lists
<rekado>the rest is as you’d expect
<rekado>also remember to use quasiquotation and procedures to generate stuff
<alextee[m]>could probably use more compex examples in the manual
*alextee[m] has no idea what s-expressions or quasiquotations are
<chrislck> https://pastebin.com/DL4YTyvk
<rekado>quasiquote is the toggle switch
<rekado>` means “data mode”
<rekado>, means “code mode”
<rekado>`(this is data but ,(+ 1 3 4) is code)
<rekado>an S-expression is just a fancy name for all of these parentheses and what they enclose.
<alextee[m]>chrislck: thanks!
<alextee[m]>oh i see
<chrislck>every guile prog is an s-expression
<alextee[m]>haven't consciously used ` or , yet so not sure how they work, although i see them in guix packages
<alextee[m]>so in the example above, this is an S-expression? '(enum (@ (id "org.zrythm.Zrythm.audio-backend-enum")) (value (@ (nick "none") (value "0"))))
<rekado>the example above is equivalent to '(this is data but 8 is code)
<rekado>alextee[m]: yes
<rekado>it’s just data
<rekado>a nested list
<chrislck>so is this: '(bla)
<chrislck>so is this: #f (I think)
<alextee[m]>ah i see
<chrislck>alextee is starting to see the matrix
<alextee[m]>:D the awakening
*chrislck read SXML and SSAX chapters several times to finally grasp it
<chrislck>using sxml will "guarantee" that your XML is well-formed
<RhodiumToad>eh.
<chrislck>ok it will be easier to write well-formed xml
<alextee[m]>doesn't look well-formatted to me: <enum id="org.zrythm.Zrythm.audio-backend-enum"><value nick="none" value="0" /><value nick="alsa" value="1" /><value nick="jack" value="2" /><value nick="portaudio" value="3" /><value nick="sdl" value="4" /><value nick="rtaudio" value="5" /></enum>
<alextee[m]>probably needs some flags to change how it outputs things
*alextee[m] reads the SXML chapter
<RhodiumToad>well-formed, not well-formatted
<alextee[m]>oh
<vms14>Hi, I'm trying to load a gnome guile library in netbsd, but I don't know what I should do, I have the gnome libraries in a different location from the guile stuff and trying to add it with setting %load-compiled-path
<vms14>(set! %load-compiled-path (list "/usr/pkg/guile/2.2/lib/guile/2.2/ccache" "/usr/pkg/guile/2.2/lib/guile/2.2/site-ccache" "/usr/pkg/lib" "/usr/pkg/libguile-gnome-2/"))
<vms14>gnome stuff is in /usr/pkg/lib/libguile-gnome folder
<vms14>and guile stuff in /usr/pkg/guile/2.2/ it has a bunch of folders there like lib, man, include, share, bin and so on
<dsmith-work>Wednesday Greetings, Guilers
<vms14>but gtk.so is in /usr/pkg/lib/guile-gnome-2/libgw-guile-gnome-gtk.so
<vms14>how I'm supposed to load those paths?
<dsmith-work>vms14: I don't have an answer for you, but just be patient. Might take a day or so.
<RhodiumToad>vms14: did it install a gnome-2.scm in the guile "site" dir?
<RhodiumToad>vms14: I made a freebsd port for guile-gnome so I have some idea of what's going on
<RhodiumToad>the theory is that you should be able to import the (gnome-2) module and it sets up all the paths for you
<vms14>RhodiumToad: found it at /usr/pkg/share/guile-gnome-2/gnome/gw/gtk.scm
<RhodiumToad>no
<vms14>so I should try to add that to the path, but which "path" variable? %load-path/
<RhodiumToad>where is gnome-2.scm
<vms14>/usr/pkg/share/guile/site/gnome-2.scm
<vms14>hmm
<RhodiumToad>right. so you should be able to just do:
<RhodiumToad>(use-modules (gnome-2) (gnome gtk) (gnome whatever...))
<vms14>does not find the module
<vms14>it seems I have to add a bunch of folders to some paths
<RhodiumToad>what exactly is not found?
<RhodiumToad>and what is your load path before you mess with it?
<vms14>(use-modules (gnome-2))
<vms14>While compiling expression:
<vms14>no code for module (gnome-2)
<vms14> "/usr/pkg/guile/2.2/lib/guile/2.2/ccache" "/usr/pkg/guile/2.2/lib/guile/2.2/site-ccache"
<vms14>that's the load path
<vms14>but the gnome wrapper stuff is installed in different paths
<RhodiumToad>that's %load-compiled-path ? what is %load-path ?
<vms14>("/usr/pkg" "/home/vms/.emacs.d/elpa/geiser-20200426.2152/scheme/guile/" "/usr/pkg/guile/2.2/share/guile/2.2" "/usr/pkg/guile/2.2/share/guile/site/2.2" "/usr/pkg/guile/2.2/share/guile/site" "/usr/pkg/guile/2.2/share/guile")
<RhodiumToad>but not /usr/pkg/share/guile/site ?
<vms14>just that
<RhodiumToad>that looks like a somewhat confused default
<vms14>so, I've just need to add /usr/pkg/share/guile/site to load-path?
<RhodiumToad>yes
<vms14>it seems I'll have to add several folders to several load paths
<vms14>I'll try thanks
<RhodiumToad>no
<RhodiumToad>just add that one directory to that one path, nothing else
<vms14>ohhh, done
<vms14>thanks you so much
<vms14><3
<RhodiumToad>(my freebsd port of guile-gnome is blocked on a portmgr review, unfortunately, but I use it locally)
<vms14>you can switch to netbsd :D
<vms14>the team is really awesome
*RhodiumToad would rather not :-)
<vms14>:O
*vms14 cries
*dsmith-work ran netbsd on a cobalt qube for a while.
<RhodiumToad>the annoying thing about going a freebsd port for guile-gnome was having to patch the hell out of the autoconf script to make it respect --without-BLAH options
<dsmith-work>vms14: So how is guile on nbsd?
<vms14>dsmith-work: can't tell you really, just installed it, I don't even know scheme, I use common lisp with sbcl
<vms14>and I could say support for sbcl in netbsd is kinda bad :/
<vms14>no thread support and most libraries using ffi won't work since they assume linux paths
<dsmith-work>Just curious becuse I know nbsd is very picky about posix things. No linux-isms there!
<vms14>usually in netbsd is a hell to install libraries in a not mainstream language since netbsd tends to separate in folders what it comes in base and what the user has installed
<RhodiumToad>hm, freebsd is no different in that respect?
<vms14>/usr/pkg is where your installed stuff goes, so you have /usr/lib and /usr/pkg/bin
<RhodiumToad>(just /usr/local rather than /usr/pkg)
<vms14>I should work on that someday and try to add a way to make languages find their libraries
<vms14>btw thanks for helping me with that
<civodul>wingo: i'm testing a trick to avoid malloc/free/dynwind in most cases for POSIX subrs that take a string
<civodul> https://paste.debian.net/1143749/
<civodul>i'll post a patch & figures soon if that makes sense to you
<wingo>civodul: nice! do we have internal pointers enabled?
<wingo>otherwise returning a pointer into a string could be a hazard
<civodul>ah good point, we don't have internal pointers
<civodul>and STRINGBUF_CONTENTS is a pointer in the middle of the stringbuf
<civodul>but OTOH, for this use case, it's fine because the Scheme string outlives the C pointer returned
<civodul>WDYT?
<wingo>civodul: i am not so confident making the assertion that a C compiler wouldn't remove the SCM. depends on the use site but it's a bit iffy
<wingo>one of those occasions where what one would want is C++ with RAII :)
<dsmith-work>sneek: botsnack
<sneek>:)
<dsmith-work>sneek: seen rlb
<sneek>rlb was last seen in #guile 18 hours ago, saying: s/your/you're/.
<dsmith-work>sneek: testing is Testing, Testing, One Two Three..
<sneek>I'll keep that in mind.
<dsmith-work>sneek: testing?
<sneek>Someone once said testing is Testing, Testing, One Two Three..
<dsmith-work>sneek: forget testing
<sneek>Consider it forgotten.
<dsmith-work>sneek: testing?
<dsmith-work>sneek: botsnack
<sneek>:)
<dsmith-work>goodbot
*sneek wags
<alextee[m]>is there a variant of (format) that returns the string instead of printing it?
<alextee[m]>oh #f
<civodul>wingo: hmm even if it were removed, the SCM is still in the VM stack no?
<wingo>civodul: that is not guaranteed. in practice though, yes.
<guix-vits>sneek: seen sneek?
<sneek>Sewni was in (here?) 7 months ago, saying: I didnt realise you were using the bot :P.
<dsmith-work>alextee[m]: Also can be a port, so you could pass a string port. Might be useful for building a string a piece at at time.
<guix-vits>sneek: seen sneek?
<sneek>Sewni was last seen in (here?) 7 months ago, saying: I didnt realise you were using the bot :P.
*guix-vits "ah, some sort of regex"
<dsmith-work>alextee[m]: I wouldn't be surprised if #f is implmented by printing to a string port internally and then returning the string.
<alextee[m]>so many ways to do things in scheme, fun
<civodul>wingo: ok, i've sent what i have to guile-devel + you!
<dsmith-work>Hah!
<dsmith-work>alextee[m]: Indeed, #f uses (open-output-string)
<dsmith-work>sneek: botsnack
<dsmith-work>sneek: botsnack
<sneek>:)
<dsmith-work>Interesting!
<dsmith-work>So the problem I was having with for-each being undefined goes away when using srfi-1
<dsmith-work>(which also defines a for-each)
***dsmith-work is now known as someoneelse
<someoneelse>sneek: later tell dsmith-work It's working.
<sneek>Got it.
***someoneelse is now known as dsmith-work
<dsmith-work>Ok
<sneek>Welcome back dsmith-work, you have 1 message!
<sneek>dsmith-work, someoneelse says: It's working.