A particular macro runs each expression in its body, interleaving an atom between each expression, and collecting the results.
This works well with hard-coded expressions, but if I want to dynamically generate a series of expressions to be inserted in the body of the macro call, that won't work, obviously, because that will be evaluated after the macro has done its job.
I suppose the solution is to write my own macro to generate the expressions I need, but I'm not sure that will be evaluated before the outer macro.
I tried something like this, but it didn't work:
(mac genexpr (list)
(map (fn (e) `(something ,e)) list))
Try using a begin
(scheme) or progn
(common lisp) form. It looks like you're using arc, which appears to name this construct do
.
(mac genexpr (list)
`(do ,@(map (fn (c) `(something ,e)) list)))