I found myself defining syntax parameters with identical definitions except for their name so I decided to write a macro to make this simpler:
(define-syntax (test-case-parameter stx)
(syntax-parse stx
[(_ parameter:id)
#'(define-syntax-parameter parameter
(lambda (stx)
(raise-syntax-error stx "Can only be used inside test-case.")))]))
(test-case-parameter a)
(test-case-parameter b)
(test-case-parameter c)
However instead of having to repeat the macro name I would like to be able to just write:
(test-case-parameter a b c)
But I don't see how to do this using the normal ellipses syntax, because I would need to wrap everything in a begin
which would create a new scope, and I want all of the syntax parameters as if I had written them each of the top level. What's the right way to accomplish this?
begin
doesn't have scoping behavior in a pure expression context: it disallows definitions entirely in contexts where it can't splice definitions in – Fortieth