IRC channel logs

2020-08-05.log

back to list of logs

<jgart>what would be the best way to translate this bash snippet to idiomatic guile? $ find / -type d 2>/dev/null | shuf | tail -n 1
<jgart>the above chooses a random directory from /
<jgart>pasting this one liner here again just in case the line length makes it hard to read:
<jgart>$ find / -type d 2>/dev/null | shuf | tail -n 1
<ft>Probably something involving file-system-fold from (ice-9 ftw), build a directory list as you go, producing a random integer from 0 to length-of-list minus one, and list-ref to that.
<ft>Not sure if there's list-shuffling built in. If there is, you could do that and take the head of that.
<ft>Random number generators are in (srfi srfi-27).
<justin_smith>a cute option would be to ask the OS how many directories are allocated on each FS, do a weighted choice from the mount points, then rand-Nth directory under that choice
<jgart>ft, justin_smith thanks for your suggestions! I will give it a go
***str1ngs_ is now known as str1ngs
<leoprikler>as pointed out, rand-Nth suffices, but if you ever need to do list shuffling, just implement Fisher-Yates
<leoprikler>It's pretty straight-forward to do list->array and array->list conversions
<leoprikler>to do via*
<leoprikler>list->vector and vector->list ._.
<dsmith>Probably will be a fairly long list
<daviid>sneek: seen lloda
<sneek>lloda was in #guile 25 days ago, saying: (help) doesn't seem to like it when I export from a macro.
<daviid>sneek: later tell lloda I was thinking that you might want to ping the debian guile-cairo package maintainer, debian bullseye (testing), so even testing, stilll point to 1.10 ... fwiw
<sneek>Okay.
***catonano_ is now known as catonano
<peanutbutterandc>is there a way in guile for me to see the definition of a procedure in the repl?
<peanutbutterandc>this procedure might even be dynamically generated (i.e. the defintion does to come from a loaded file)
<str1ngs>peanutbutterandc: I find it easier to use geiser and M-. which is geiser-edit-symbol-at-point
<peanutbutterandc>str1ngs, Hey there! I am sorry, it seems this is some emacs spell and I am not yet well-versed in either emacs or guile. Being a relative beginner, I was hoping for something on the repl
<str1ngs>peanutbutterandc: I'
<str1ngs>peanutbutterandc: hello, I'm not sure how to do this in a REPL.
<str1ngs>peanutbutterandc: you don't have experience in emacs?
<str1ngs>peanutbutterandc: I'm still not sure how to do this from a REPL
<peanutbutterandc>str1ngs, Not much, sir. Except the usual writing and saving (becuase emacs formats scheme code really well - the indenting and all)... I see. guile seems to provide a ton of things at the repl. And so I was thinking that there might be something there
<str1ngs>peanutbutterandc: need to get some sleep. hopefully someone more knowledgeable can help. ttl
<peanutbutterandc>str1ngs, Thank you nevertheless. Good night
<roelj>So.. if I use http-post, and the response is a 302 redirect. Can something in the web modules follow the redirect?
<alextee[m]>Does guile have any musical libraries?
<alextee[m]>Like for processing revolving around musical chords
<roelj>Like creating sheet music? Or like producing sounds?
<alextee[m]>I guess if there's a c library you could guile-ify it though
<alextee[m]>roelj: taking in some notes and giving you a list of chords or scales they are in for example
<alextee[m]>Or some AI that suggests chord progressions based on the previous chord
<roelj>alextee[m]: Hm, there's https://git.elephly.net/?p=software/scales.git;a=summary bit it's a "starting point" at best for what you are looking for. :)
<alextee[m]>Hmm not quite what i'm looking for
<alextee[m]>I guess i'll look at github and if i dont find anything i'll write a C library, then use that fancy script to produce a Guile API
<alextee[m]>This! https://github.com/yuma-m/pychord
<bitwiz>alextee[m]: Lilypond has Guile scripting
<bitwiz>(...for making sheet music)
<alextee[m]>dont think lilypond has what im looking for
<bitwiz>Ah, just saw what you were asking for (something for number-crunching scales essentially). It would be an interesting project to implement directly in Guile
<alextee[m]>sounds much easier to do it in guile, but i want a C api too
<bitwiz>alextee[m]: Maybe there's a C/some other language version, that you could create C/Guile bindings for? That seems more likely
<bitwiz>Here's something in Python: https://github.com/gciruelos/musthe
<roelj>alextee[m]: You could also invoke Guile code from C if you want to turn things upside down :)
<bitwiz>Much more extensive, also in Python: https://github.com/cuthbertLab/music21/
<alextee[m]><roelj "alextee: You could also invoke G"> wouldn't that be slow if you need performance?
<alextee[m]>bitwiz: thanks, i also found 2 libraries in python that kinda similar things: http://chordrecognizer.sourceforge.net/ https://sourceforge.net/projects/scgen/
<alextee[m]>not sure how to create c or guile bindings for python code
<roelj>alextee[m]: You get the speed of Guile.. If that's not fast enough, you could implement the performance-critical parts in C and call that from Guile.
*chrislck wonders what is the benefit of a superfast musical chord generator..... music isn't exactly a performance-critical industry.....
<roelj>chrislck: Perhaps if you want an AI to compose music, you could brute-force hits!
*str1ngs cranks up the techo! head bobs
*chrislck bobs head at 60Hz and counting....
<chrislck>actually, my bad: music is all about *performance*
<chrislck><-- slap
<alextee[m]>chrislck: there are workarounds and caching that can be done, but consider if you need to covert a chord into its MIDI notes during an audio processing cycle
<alextee[m]>calling another process or guile code is a no-no in that case. just an example
<roelj>alextee[m]: Oh I see, so you want to keep a low latency.. I don't have any metrics, but I can imagine that Guile's garbage collector may get in the way of low latency.
*chrislck nods in agreement
<alextee[m]>well, i'll probably write a C library, as i see there's none, and produce some guile bindings so you could write scripts to do some non-low-latency processing
*chrislck wants to port imgui to guile
<lloda>gonna commit the fix for https://lists.gnu.org/archive/html/bug-guile/2020-08/msg00010.html
<sneek>Welcome back lloda, you have 1 message!
<sneek>lloda, daviid says: I was thinking that you might want to ping the debian guile-cairo package maintainer, debian bullseye (testing), so even testing, stilll point to 1.10 ... fwiw
<lloda>wingo: if it's ok, it's a trivial thing
<lloda>leoprikler: there are functions array->list and list->array already which are type generic
<lloda>not sure that's what you meant
<leoprikler>maybe, but for fisher-yates conversion to/from vector is enough
<lloda>the patch for #42713 changes things a bit
<lloda>before you could call test-current-runner after test-end, but now that gives #f
<lloda>that seems correct to me but I was relying on the old behavior
<lloda>anyway, pushed
<str1ngs>sneek later tell daviid. can just check this snippet http://paste.debian.net/1159198. And make sure I'm getting the 'ok enum right for gtk-response-type. you can import it with (gi-import-by-name "Gtk" "ResponseType").
<sneek>Will do.
<str1ngs>sneek: later tell daviid. I can help think there is a better way to do this.
<sneek>Okay.
<dsmith-work>UGT Greetings, Guilers
<str1ngs>hello dsmith-work
<chrislck>\./
<chrislck>|o\
<a_v_p>Guilers, is there a way to get rid of the REPL prompt altogether?
<guix-vits>IDK. In the meantime You can try `,option prompt ""`.
<guix-vits>a_v_p: ^^
<a_v_p>guix-vits: Thanks!
<a_v_p>Guilers, I started a project called "Metabash". It's a Guile library that allows to run distributed processes connected by pipes similar to Unix pipes: https://github.com/artyom-poptsov/metabash
<a_v_p>Basically with Metabash one can run 1st process on host1.example.org, 2nd on the local machine and the 3rd on host2.example.org in one pipeline.
<a_v_p>I thought it would be fun to have such a facility for Guile.
<pkill9>cool a_v_p
<manumanumanu>sneek: later tell jgart I am the srfi-171 author. If you have any questions you can ask me here, or even better PM me.
<sneek>Okay.
<manumanumanu>sneek: later tell jgart but srfi-171 would be a bad choice. SRFI-158 would be a much better choice.
<sneek>Okay.
<guix-vits>bb
***heroux_ is now known as heroux