#lang scheme (require (for-template scheme/base scheme/contract)) (provide checking-proc) (define-syntax (checking-proc stx) (syntax-case stx () [(_ internal-name (x ...)) #'(lambda (syn) (syntax-case syn () [(_ x ...) (quasisyntax/loc syn (internal-name x ...))] [(_ y (... ...)) (raise-syntax-error #f (format "Expected ~a arguments, but got ~a" (length '(x ...)) (length (syntax->list #'(y (... ...))))) syn)] [_ (raise-syntax-error #f "Functions may be used only in operator position." syn)]))]))