Next: Primitives Up: Procedures Previous: Procedures

## Arity

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

• (arity f) returns information about the number of arguments accepted by the procedure f. 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
• 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-at-least? f n returns #t if the procedure can accept n arguments (where n is an exact integer), #f otherwise.

For example:

```  (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
```

PLT