[racket] Contract for function with vararg

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sun Jun 29 21:26:05 EDT 2014

On Sun, Jun 29, 2014 at 7:44 PM, Roman Klochkov <kalimehtar at mail.ru> wrote:
> 2Robby:
>
>> (define/contract (test f) (-> (->* (input-port? any/c) #:rest list? any)
>> any)
>     1)
>> (test (λ (x y) 2))
> . . test: contract violation
>   expected: a procedure that accepts 2 non-keyword arguments and arbitrarily
> many more
>   given: #<procedure>
>   accepts: 2 arguments
>   in: the 1st argument of
>       (->
>
>        (->* (input-port? any/c) #:rest list? any)
>        any)
>   contract from: (function test)
>   blaming: anonymous-module
>   at: unsaved-editor322:14.20
>
> So doesn't work.

Oh, I see. So is the plan to guard calls to procedures that have this
contract with arity checks?

Robby


Posted on the users mailing list.