Version: 3.99.0.23
9 Contract utilities
(require (planet untyped/unlib/contract)) |
Utilities for use with the PLT contract library.
(arity/c arity) → flat-contact? |
arity : natural? |
Returns a flat contract that requires the input to be procedure that accepts the specified number of (non-keyword) arguments. The procedure may, in addition, accept more and/or fewer arguments and any number of keyword arguments.
Examples: |
> (define c (arity/c 2)) |
> (contract-first-order-passes? c (lambda (a b) (void))) |
#t |
> (contract-first-order-passes? c (lambda (a b c) (void))) |
#f |
> (contract-first-order-passes? c (lambda (a [b #f]) (void))) |
#t |
> (contract-first-order-passes? c (lambda (a b #:c c) (void))) |
#t |
> (contract-first-order-passes? c (lambda (a #:b b) (void))) |
#f |