Hi, @sora22.
It can be tricky to know "the shape" of these kinds of forms, but it is helpful to remember that syntax/loc is like syntax, i.e. #', but with the source-location data from the stx in the first argument.
So, for example, this works:
#lang racket/base
(require
(for-syntax
racket/base
syntax/parse))
(define-syntax (example stx)
(syntax-parse stx
[(_ vals ...)
#:attr val* (syntax/loc stx (vals ...))
#'(begin . val*)]))
(example 14)
;=> 14
But that doesn't really answer your question.
I think technically what you want to do, is related to quasisyntax/loc, which is again, like quasisyntax, i.e. #, but with source-location information from the relevant syntax.
Ag, and then I go and talk nonsense. quasisyntax is supposed to be related to "#`". The idea is there, I apologize for being a moron.
So, this also works:
(define-syntax (exampleâ‚‚ stx)
(syntax-parse stx
[(_ vals ...)
#`(begin #,@(quasisyntax/loc stx (vals ...)))]))
Other more experienced Racketeers will be able to give a more definitive answer, because I can only see the "shape" mismatch, but not necessarily the clear rationale for how this should be done.