IRC channel logs

2022-10-18.log

back to list of logs

<rlb>Guile's far better if you need something "posixy". For example it wasn't *all* that long ago that the jvm still didn't believe in symlinks. And it only recently added support for unix domain (filesystem) sockets. Guile's also far better for short-lived commands since even on a reasonably fast laptop, the clojure no-op time (equivalent of guile -c '') was between a half and one second.
<rlb>I *suspect* the jvm's likely better on the performance front, and on the "built in facilities" front, particularly for concurrency, and clojure's also better there too imo, with comprehensive persistent data structures and tools, and commands to manipulate them consistently.
<rlb>but ymmv
<rlb>Things like visualvm and flight-commander/mission-control are also very fancy when things go wrong, but of course all that infastructure isn't free.
<lampilelo>old: you really should implement per-thread queues with task-stealing for your scheduler
<a12l>rib: Thanks for you opinion!
<lampilelo>old: https://youtube.com/watch?v=zULU6Hhp42w&t=1698
<a12l>I'm reading § 3.4.1. in the reference manual. Is variables named pointers to memory cells(vcells)?
<rlb>a12l: I believe the vcell is the "box" (big enough to hold a pointer) referred to by the variable name, i.e. if you say (define x something) the vcell is the box that x then refers to that contains something's pointer.
<rlb>And then (set! x something-else) changes the contents of the "box" to be something-else's pointer.
<old>lampilelo: Interesting. Seems easy to implement and I could get rid of (ice-9 q) and use (parallel queue) instead.
<old>Will do
<old>I wonder if (ice-9 futures) does that kind of scheduling
<old>;; TODO: Use per-worker queues to reduce contention.
<old>Guess I got my answer :-)
<a12l>rlb: But wouldn't the variable name then be the pointer to the "box"? I'm little confused :P
<rlb>Well conceptually x just refers to (somewhere) 8 bytes of ram on a 64-bit arch, that contains the pointer representing "something", I think. So imagine we have 5 variables in a let binding, and we decide to represent that as a block of memory 5x8bytes malloced on the heap, and then we decide that the value of x is going to be stored in the third entry in the block (block[2] if you think of block as an array of 8-byte pointers). Then
<rlb>the "something" pointer would be stored in eight bytes in the block,starting at the 24th byte.
<rlb>(Not sure if it helps or hurts to make it more concrete like that.)
<KREYREN>umm is it possible in scheme to make something like:
<KREYREN>(define (define-task first second third fourth) ...)
<KREYREN>(define-task (kreyren args) "docs" ...)
<KREYREN>To make the `(kreyren args)` available as first argument in the `define-task` without trying to execute `kreyren` procedure?
*KREYREN is trying to make the (define-rule "name" '(args) body) used in potato-make more scheme-like to reduce the codebase
<flatwhatson>you can use define-syntax-rule to make a simple macro to do it
<KREYREN>oh didn't realize that thanks
*KREYREN sent a scm code block: https://libera.ems.host/_matrix/media/r0/download/libera.chat/4a8a54c241bcd5edd96466bcf439b0324499eefc
*KREYREN though that he knows how, but doesn't >_>
<KREYREN>expecting define-task to output in terminal:
<KREYREN>* (hello args)
<KREYREN>* "This task says hello"
<KREYREN>* (cond ((equal? ...)
<KREYREN>.. so that i can process them later
<flatwhatson>KREYREN: have you read the manual about define-syntax-rule?
<flatwhatson>(define-syntax-rule (define-task first rest ...) (define-task-helper 'first rest ...))
<KREYREN>yes it's just one section that doesn't say much
*KREYREN uploaded an image: (43KiB) < https://libera.ems.host/_matrix/media/r0/download/tchncs.de/35c77f45b404f32ad64610eb7d924ac4687f39f8/image.png >
<KREYREN>flatwhatson: trying
<flatwhatson>you can't have both a macro and a function called "define-task", so my example renamed the function to define-task-helper
<flatwhatson>the manual on syntax-rules has more detail about how those patterns work
<KREYREN>The `6.8.1. Defining Macros` ?
*KREYREN is reading the manual and trying to poke the code with words while being confused to why it doesn't work
<KREYREN>are the `...` a syntax or just representation of things to be added?
<KREYREN>representation
<KREYREN>hmm
*KREYREN sent a code block: https://libera.ems.host/_matrix/media/r0/download/libera.chat/0d2c40ea63797572d3149b0f8731ef0364ea4e5f
<KREYREN>am i at least on the correct path to the solution?
<flatwhatson>KREYREN: a syntax-rules macro rewrites its arguments into the form in the body
<flatwhatson>so you have a syntax rule for (define-task first rest ...) which rewrites to (define-task-helper 'first rest ...)
<lilyp>No you're not. Note that first = (hello args)
<flatwhatson>better to make define-task-helper a normal function instead of another layer of macros
<flatwhatson>so you just have a function which takes regular arguments, and a macro which "prettifies" that function call
<flatwhatson>then it's easy to debug & test the function separately
<flatwhatson>in a lisp, when you want to pass (kreyren args) without executing it, you need to quote it.
<flatwhatson>the define-task macro i wrote above just quotes its first argument before passing everything to define-task-helper function
<lilyp>I think for define stuff you do want nested macros though
<KREYREN>flatwhatson: i know that much but i dunno how to parse it in a way so that it does what i want
<lilyp>or syntax-case with functions that are evaluated at compile time
<flatwhatson>lilyp: baby steps
*KREYREN is confused and has no idea what to do
<KREYREN>so like function then?
<KREYREN>how would that work
<KREYREN>since like the `(hello args)`
<KREYREN>and like this is code for production environment so if nested macros are better solution then better to pursue that
*KREYREN sucks at macros in guile though
<flatwhatson>KREYREN: you just need to think about what you want it to expand into
<lilyp>KREYREN: note that you can destructure bindings: (_ (name args ...) body body* ...)
<flatwhatson>eg. here's a define-task which just defines a function
<flatwhatson>(define-syntax-rule (define-task (name args ...) body ...) (define (name args ...) body ...))
<flatwhatson>how is a "task" different to a function?
<KREYREN>flatwhatson: the end goal is to do (define (some-task args) "docs" some-body) and declare alist with '((some-task "docs")) that can be then processed for CLi management
<KREYREN>so i just wanted to wrap the whole thing atm
<flatwhatson>KREYREN: it might help to break down (define (some-task args) ...) further then
<flatwhatson>it's actually (define some-task (lambda (args) ...))
<KREYREN>eh?
<flatwhatson>so maybe you want (define some-task (register-task 'some-task (lambda (args) ...)))
<flatwhatson>where (register-task name thunk) does some global registration and returns the thunk
<flatwhatson>or wraps the thunk with some wrapper code or whatever.
<KREYREN>that sounds as better solution 🤔 assuming that i can make register-task to store alist with metadata accessible within the scope of the function and CLI management
<flatwhatson>it's all lexical scope, so that's easy. you can have (define %global-registry '()) right above (define (register-task ...
<KREYREN>e.g. task with tag "rust" to be automacially accessingle in rust environment in the projected gold phase
<KREYREN>oh cool, going to try to implement it then thanks
*KREYREN uploaded an image: (117KiB) < https://libera.ems.host/_matrix/media/r0/download/tchncs.de/192a029c4e99534574add59d033e462918921eba/image.png >
<KREYREN>is there a way to make guile to not shorten the important bits for me?
<lampilelo>KREYREN: COLUMNS=1000 guile ./your-file.scm
<KREYREN>lampilelo: hmm i can't let it touch my env vars.. is there a configuration thing?
<lampilelo>KREYREN: hm, try calling (terminal-width 1000) from (system repl debug) module, i think it should work
<lampilelo>((@ (system repl debug) terminal-width) 1000) if you don't want to import the whole module
<lampilelo>if it works, you can add it to ~/.guile if you want it to be a persistent setting, and you don't want to it in your code
*KREYREN doesn't know how to generate a long error output from the thing
<lampilelo>KREYREN: this works for me: http://dpaste.com/C3TPSGKC6
<KREYREN>thanks!
<civodul>the new GnuTLS bindings: https://gitlab.com/gnutls/guile/
<lampilelo>civodul: nice, is this going to be a part of gnutls distibution? (fyi: the copyright notice in guile/src/core.c wasn't updated to list the current year)
<civodul>lampilelo: it was part of GnuTLS proper, but it's becoming a separate package
<lampilelo>and why is that?
<civodul>it had become a bit of a burden for everyone involved to keep them together
<civodul> https://lists.gnupg.org/pipermail/gnutls-help/2022-October/004772.html
<lampilelo>i guess that makes sense
<civodul>yup
<a12l>rlb: Thanks for the explanation! I'm still a little bit confused, and can't only find links to Guile's documentation when I search for `vcell scheme` on Google. Does `vcell` has another term in the rest of the Scheme ecosystem?
<a12l>Found this explanation that explain it nicely: http://cs.rpi.edu/academics/courses/fall00/ai/scheme/reference/schintro-v14/schintro_14.html
*KREYREN sent a code block: https://libera.ems.host/_matrix/media/r0/download/libera.chat/92e0731b44c9ff7124e36fe7fb5f0e0440f5ee7f
<xd1le>KREYREN, I'm not sure exactly what you are asking, but perhaps you are looking for something like this:
<xd1le> https://guix.gnu.org/en/manual/devel/en/guix.html#Defining-Package-Variants ?
<xd1le>#:select is just for selecting specific bindings from a module to make them available in the current module
<xd1le>also you can ask in #guix btw if it's a guix specific thing you need help with
<KREYREN><xd1le> "6piz7wk, I'm not sure exactly..." <- like how to import multiple things from one module?
<KREYREN><xd1le> "also you can ask in #guix btw if..." <- Does nckx still has a mod? else not going there
<xd1le>KREYREN, oh ok, so it should just be #:select (origin package)
<KREYREN>seems to work thanks ^-^
<xd1le>np
<xd1le>yes nckx still mod btw
<nckhexen>Yup.
<nckhexen>Ban evasion: frowned upon.
<dsmith-work>Hey Hi Howdy, Guilers
<old>lampilelo: I added per thread queue with queue stealing
<lampilelo>old: nice, now you can benchmark it against wingo's fibers library ;)
<old>lampilelo: Sure. However I'm not sure if that's worth it. Comparing parallelism and concurency is like comparaing apple and orange?
<old>Maybe there's a scenario were both could be benchmark against one or the other
<lampilelo>fibers library uses parallelism as well
<old>lampilelo: Really? I though it was only doing coroutine with continuation
<old>Thus single thread
<old>If it does parallelism then yes might as well compare them
<lampilelo>i think it started like that, but it's no longer the case
<old>okay
<Zelphir>What I have always wondered is, how one can use fibers conditionally, depending on for example the value of a variable. For example I could have a variable which contains 'futures or 'fibers and depending on that, I want to either use futures or fibers library. But it seems to me, that one must always have (run-fibers ...) at some level above, to use fibers. But if one does that, one could not switch to use only futures.
<stis>Hej guilers!
<Zelphir>Hello Stis!
<jab>hey guile users! Just an awesome praise: I had a tiny programmer problem to solve today. Opening up a geiser repl made it so easy to solve!
<jab>thanks for existing guile!
<lampilelo>Zelphir: mixing the two seems redundant, since their threads would fight each other
<Zelphir>Not aiming to mix the two. My use case was either or. One or the other. For example I wanted to give a choice to a user of a program which ones to use, but could not find a way to do so. Could also be in other contexts like "Is fibers installed? No? Then use futures.".
<lampilelo>Zelphir: you could do it with cond-expand
<lampilelo>i think
<Zelphir>Next time I try anything with fibers again, I will look into that.
<dsmith-work>jab: Yey!
<jab>dsmith-work: yup!
<old>lampilelo: I'm not sure how I could benchmark the two to be honest. Seems like `run-fibers` will only use a single core
<Zelphir>Maybe this is helping: https://github.com/wingo/fibers/issues/34 ?
<Zelphir>Specifically maybe this: https://github.com/wingo/fibers/issues/34#issuecomment-1144722441
<old>Right. This is problematic for any type of code that pause
<old>I'll start with benchmarking with futures instead
<stis>old: I think guile automagically inserts ops so that you do not need to explicitly pause
<stis>also you can make fibers run with multiple threads
<stis>old: so if you use the right API for accessing sockets, you will not be cursed by pause
<old>lampilelo: (parallel scheduler) is 2.86 time faster than (ice-9 futures) from a quick benchmark