IRC channel logs

2024-12-29.log

back to list of logs

<gabber>i'm having a hard time writing a macro that logs function calls with their arguments and output. what i like is (debug-log my-function 'hello 'asdf) to output something like: "(debug-log my-function 'hello 'asdf) => 'helloasdf"
<gabber>oh no, it the output should be "(my-function 'hello 'asdf) => 'helloasdf"
<gabber>input could also be (debug-log (my-function 'hello 'asdf)) i don't really care
<gabber> https://termbin.com/xu9p <= this attempt fails with "Wrong
<gabber>type to apply: 1" when called like: (log-args-and-output + 1 2 3)
<elpogo>gabber: i don't fully understand macros, but this works -> https://paste.debian.net/1341673/
<mwette>macros replace things literally so you'll get (apply + (1 2 3))
<mwette>try `(list args)' instead of `args'
<mwette>sometimes helps to quote things to see what is produced: (begin ... => `(begin ...
<elpogo>don't you need a dot between list and args mwette ?
<mwette>he does there (or use ellipsis: args ...)
<gabber>nice! thank you two!
<mwette>in fact, ellipsis is more appropriate: ((_ ftn args ...) (let ((r (ftn args ...))) ... (fmt "~s" (list args ...)) r))
<mwette>oops: maybe eval args once only: (let* ((al (list args ...)) (r (apply ftn args))) ...))
<elpogo>Is anyone aware of any presentations explaining guile's psyntax implementation? I know it was originally copied over from Chez Scheme, and I can read the code (which I am doing), but obviously any presentations would make understanding the code much easier.
<elpogo>I'm talking about the code in module/ice-9/psyntax.scm and psyntax-pp.scm
<civodul>ACTION is not aware of presentations about psyntax
<civodul>maybe something by Dybvig a couple of decades ago?
<elpogo>Ok. I'll keep looking. The nicest presentation I've found so far is https://www.youtube.com/watch?v=Or_yKiI3Ha4
<civodul>nice
<mwette>I believe psyntax-pp.scm is generated from psyntax.scm
<elpogo>mwette: yes it is. by ice-9/compile-psyntax.scm i believe
<mwette>there was a thorough paper on syntax case implementation by dybvig , trying to see if I can spot which one
<elpogo>Is it this one mwette -> https://legacy.cs.indiana.edu/~dyb/pubs/LaSC-5-4-pp295-326.pdf ?
<mwette>yes, I that's it
<mwette>you are digging, I see
<sneek>dsmith: wb :)
<dsmith>sneek, borsnack
<dsmith>sneek, botsnack
<sneek>:)