Arity is the number of arguments or operands that a function or operation in logic, mathematics, and computer science takes.
It means the number of arguments a function takes.
The compose function has two Arity.
const compose = (a, b) => (data) => a(b(data));
The addFive function has one Arity.
const addFive = (num) => num + 5;
In functional programming, although there are no rules of arity, a fewer number of arguments is better.
- it makes functions more flexible
- it is easy to make compose functions with fewer arguments.