<HTML><BODY><P>Why racket doesn't check arity when compiling?<BR><BR>(define (test)<BR>&nbsp; (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>&nbsp; (make-set!-transformer<BR>&nbsp;&nbsp; (λ (stx)<BR>&nbsp;&nbsp;&nbsp;&nbsp; (syntax-case stx ()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [(car* x) (syntax-protect (syntax/loc stx (car x)))]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [(car* x ...) (raise-argument-error 'car "one argument" (syntax-&gt;datum #'(x ...)))]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [car* (syntax-protect (syntax/loc stx car))]))))</P>
<P>(define (test)<BR>&nbsp; (car* 12 3))<BR><BR>But it is cumbersome (I'll have to wrap every function)&nbsp;and&nbsp;I don't understand why compiler shouldn't see function contracts.<BR><BR>-- <BR>Roman Klochkov</P></BODY></HTML>