IRC channel logs

2024-01-30.log

back to list of logs

<dthompson>guile-hoot v0.3.0 has been released :) https://spritely.institute/news/guile-hoot-v030-released.html
<mwette>So is convention r7rs lib's over guile modules?
<civodul>dthompson: yay! congrats to y’all!
<civodul>looking forward to meeting some of you in Brussels!
<dthompson>civodul: thanks! say hi to christine, robin, and jessica at fosdem!
<freakingpenguin>Is it possible to create a macro that can insert multiple replacements at the same nesting level? i.e. a macro that can pull off https://paste.debian.net/1305806/?
<dthompson>freakingpenguin: no. macros expand to *an* expression, not multiple.
<freakingpenguin>Darn, thanks.
<Arsen>freakingpenguin: hmm, why do you need more than one expr?
<freakingpenguin>Funnily enough the question came from looking at your blog's code and trying out a different way of specifying multiple stylesheets haha.
<dthompson>I'm not sure a macro would help :)
<dthompson>in your example you're using an unquote, if you wanted to splice in multiple things you could use unquote-splicing instead
<dthompson>`(a b ,@(list 'c 'd 'e)) produces the list (a b c d e) for example
<Arsen>^ right
<freakingpenguin>Ah! That seems like that could work quite well! Split the list of stylesheets into the sxml.
<dthompson>`(head ,@(map (lambda (url) `(link (@ (rel "stylesheet) (href ,url)))) '("foo.css" "bar.css")))
<dthompson>I just looked at my blog code to refresh my memory. I only have 3 css files so I didn't see a need to use 'map' and preferred a more declarative style.
<freakingpenguin>Yeah I have something like https://paste.debian.net/1305807/. Very arguably not worth it but I'll keep telling myself it's pretty! :)
<Arsen>hmm
<Arsen>qookie: did you end up also using ,@ for something?
<dthompson>freakingpenguin: do what makes you feel good! but just fyi it's not necessary for stylesheet nor stylesheets to be macros
<freakingpenguin>Haha, I was thinking that. When dealing with problems that can be solved with either macros or functions, is the rule of thumb to prefer functions?
<dthompson>yes
<dthompson>macros are not applicable, for one thing. you couldn't do (map stylesheet '("foo" "bar" "baz")) with your code
<dthompson>macros are also more complicated to write.
<qookie>Arsen: w.r.t. haunt i have a function that transforms '(section name body...) into '(section (a (@ ...) (hN name)) body...) where N depends on the nesting
<Arsen>hm, must've misrecalled then
<qookie>and i use ,@ to splice in the result of mapping the transformation function over the body
<Arsen>ah
<freakingpenguin>dthompson: Thanks for the wealth of knowledge!
<dthompson>yw hope it helps :) have fun with haunt