Next: Primitives Up: Procedures Previous: Procedures

## Arity

MzScheme's `arity` procedure inspects the input arity of a procedure:

- `(arity proc)` returns information about the number of arguments accepted by the procedure proc. The result a is either:
  - an exact non-negative integer the procedure always takes exactly a arguments;
  - an `arity-at-least` structure value the procedure takes `(arity-at-least-value a)` or more arguments; or
  - a list containing integers and `arity-at-least` structure values the procedure takes any number of arguments that can match one of the arities in the list.

- `(procedure-arity-includes? proc k)` returns `#t` if the procedure can accept n arguments (where k is an exact non-negative integer), `#f` otherwise.

Examples: ``

      (arity cons) ; => 2
      (arity list) ; => #<struct:arity-at-least>
      (arity-at-least? (arity list)) ; => #t
      (arity-at-least-value (arity list)) ; => 0
      (arity-at-least-value (arity (lambda (x . y) x))) ; => 1
      (arity (case-lambda [(x) 0] [(x y) 1])) ; => (1 2)
      (procedure-arity-includes? cons 2) ; => #t
      (procedure-arity-includes? display 3) ; => #f