(import procedural-macros) (import-for-syntax (only srfi-13 string-join) (only srfi-1 any) ) (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* ((make-name (lambda (components) (string->symbol (string-join (map symbol->string components) "/")))) (%name (make-name components))) `(define (,%name ,@components) 42)))))) (defmeth (a b c)) (print (a/b/c 1 2 3)) ; $ csc pm.scm ; # all is well ; $ ./pm ; Error: unbound variable: a/b/c ; ; Call history: ; ; pm.scm:1: chicken.load#load-extension ; pm.scm:27: a/b/c <--