(import procedural-macros) (import-for-syntax (only srfi-13 string-concatenate) (only srfi-1 any) ) (define (make-name components) (string->symbol (string-join (map symbol->string components) "/"))) ; sorry for crappy indentation (define-macro (defmeth components . optionals) (with-implicit-renaming (=? %name) (cond ((null? components) (syntax-error "The endpoint path must not be empty")) ((any (lambda (opt) (not (= (length opt) 2))) optionals) (syntax-error "The optional parameters must have the form (type param)")) (else (let ((%name (make-name components))) `(define (,%name ,@components) 42)))))) (defmeth (a b c)) ; Error: during expansion of (defmeth ...) - unbound variable: make-name ; ; Call history: ; ; (##core#begin (defmeth (a b c))) ; (defmeth (a b c)) ; (cdr89 form92) ; (seq-ref119 seq124 0) ; (seq-tail121 seq124 1) ; (inject94 (quote name)) ; (null? components) ; (any (lambda (opt) (not (= (length opt) 2))) optionals) ; (make-name components) <--