(module check-syntax mzscheme
(provide lambda-formals? check-formals check-symbols)
(define (lambda-formals? stx)
(let loop ((stx stx) (accum '()))
(syntax-case stx ()
(() (not (check-duplicate-identifier accum)))
(x (identifier? #'x) (not (check-duplicate-identifier (cons #'x accum))))
((x . y) (identifier? #'x) (loop #'y (cons #'x accum)))
(_ #f))))
(define (check-formals stx)
(andmap lambda-formals? (syntax->list stx)))
(define (check-symbols stx)
(let ((symbols (syntax->list stx)))
(and (andmap identifier? symbols)
(not (check-duplicate-identifier symbols)))))
)