[plt-scheme] Re: Contract question

From: David Van Horn (dvanhorn at cs.brandeis.edu)
Date: Mon Jan 23 14:55:36 EST 2006

pedro pinto wrote:
> Hi there,
>  
> I just started fumbling around with contracts and I was trying to write 
> a contract for a function similar to map:
>  
> map proc clist1 clist2 ... -> list
>  
> Is there a way to say that proc is a procedure whose arity should match 
> the number of clist arguments?

(->r ([proc
          (and/c procedure?
            (lambda (_)
              (procedure-arity-includes? proc
                 (length arg-lists))))])

    arg-lists (lambda (_) (ormap proper-list? arg-lists))
    proper-list?)



Posted on the users mailing list.