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>type to apply: 1" when called like: (log-args-and-output + 1 2 3) <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 ...) <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? <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