<HTML><BODY><P>Why racket doesn't check arity when compiling?<BR><BR>(define (test)<BR> (car 12 3))<BR><BR>compiles and even runs. Ir raises an error only when test is called.<BR><BR>I can have desirable result making<BR><BR>(define-syntax car*<BR> (make-set!-transformer<BR> (λ (stx)<BR> (syntax-case stx ()<BR> [(car* x) (syntax-protect (syntax/loc stx (car x)))]<BR> [(car* x ...) (raise-argument-error 'car "one argument" (syntax->datum #'(x ...)))]<BR> [car* (syntax-protect (syntax/loc stx car))]))))</P>
<P>(define (test)<BR> (car* 12 3))<BR><BR>But it is cumbersome (I'll have to wrap every function) and I don't understand why compiler shouldn't see function contracts.<BR><BR>-- <BR>Roman Klochkov</P></BODY></HTML>