IRC channel logs

2020-09-24.log

back to list of logs

***mrkotfw_ is now known as mrkotfw
***catonano_ is now known as catonano
<pinoaffe>dsmith-work: so I'd have to use something like (define-syntax macro-apply (syntax-rules () ((macro-apply macro exp* ...) (primitive-eval (list macro 'exp* ...)))))? or is there a better option?
<roptat>is there a way to define a macro that generates multiple top-level expressions?
<roptat>I'm trying to do something like this: (define-syntax do (syntax-rules () ((_ a b) (define a 1) (define b 2))))
<roptat>then (do one two) would define two variables, one and two to 1 and 2 respectively
<RhodiumToad>generate a (begin ...)
<roptat>ah yes, I just saw that
<roptat>I thought that would create a scope out of which one and two would not be defined
<RhodiumToad>at top-level, (begin x y) has the effect of splicing in x and y at top level, rather than creating any new scope
<bitwiz>You could also make a recursive expansion, but if you know there are only two defines, that's total overkill
<roptat>I actually don't know how many defines there will be
<roptat>what's a recursive expansion?
<bitwiz>i.e. something like where your 'do' expands to (define a 1) (do b) -> (define a 1) (define b 2)
<roptat>ah, ok :)
<RhodiumToad>often not needed, considering you can use ...
<RhodiumToad>e.g. ((_ def ...) (begin (define def somestuff) ...))
<bitwiz>Do the variable names get passed in to your macro, or do you generate them in the macro? If the latter, watch out for https://www.gnu.org/software/guile/manual/html_node/Hygiene-and-the-Top_002dLevel.html
<leoprikler>quick question regarding (ice-9 i18n): (gettext ...) can handle multiline strings, yes?
<dsmith-work>Hey Hi Howdy, Guilers