Single-use macros

In addition to code-reuse, macros also come in handy for ad-hoc templating. I often have to repeat the following pattern:

(define-syntax (xxx stx)
  #`(...
     #,@(for/list ...)
     ...)

xxx

and never use xxx again.
This works, but does not seem to be not a neat solution. Is there a better way to do it?

Maybe you could use let-syntax?

I want something like this:

(do-macro
  #'(...))

Then I won't need a temporary name. Is this built into the lamguage, or could be abstracted with a macro?

See begin/inject-syntax in Scramble.

1 Like