Arity (of a function)

Written by So8res last updated

The arity of a function is the number of parameters that it takes. For example, the function is a function with arity 4, and is a function with arity 2; 2-arity functions are known as binary functions.

A function is said to take multiple parameters when its domain is the product of multiple sets. For example, consider the function is_older_than that takes (as input) a person and an age and returns yes if the person is older than that age, and no otherwise. The domain of is_older_than is the set of all pairs of people and ages, which we might write as . Because this set is a product of two sets, we say that is_older_than is a function of two parameters, and that it has arity 2.

Parents: