arity
Học thuậtThân thiện
Definition
Noun: - The number of arguments that a function can take: In logic, mathematics, and computer science, "arity" refers to the fixed number of arguments or operands that a function, operation, or relation requires. A function's arity defines its input structure.
Usage
- "Arity" is a technical term used primarily in formal contexts such as programming, logic, and mathematics.
- It is often used with adjectives to specify the number (e.g., nullary, unary, binary, ternary, n-ary).
- Example:
Examples
- In programming:
- In logic:
- In mathematics:
Advanced Usage
- Fixed vs. Variable Arity: Some functions have fixed arity, while others, like variadic functions, can accept a variable number of arguments.
- In some programming languages,
printfis a function with variable arity.
- Adjectival Forms: The concept is commonly expressed using adjectives derived from arity.
- Binary operations are fundamental in arithmetic. (Here, "binary" implies an arity of two).
Variants and Related Words
- Adjectival Forms:
- Nullary (adj): Having an arity of zero; taking no arguments.
- A nullary function is often a constant.
- Unary (adj): Having an arity of one.
- The unary minus operator changes the sign of a number.
- Binary (adj): Having an arity of two.
- Addition is a binary operation.
- Ternary (adj): Having an arity of three.
- N-ary or Multary (adj): Having an arity of 'n' or multiple arguments.
Synonyms
- Argument count: (Informal) The number of arguments.
- Adicity: A synonymous term used especially in logic and philosophy.
- Degree: Sometimes used interchangeably, particularly for predicates in logic (e.g., the degree of a relation).
Related Terms and Concepts
- Function Signature: A broader concept that includes the arity along with the types of arguments and return value.
- Parameter: The variable listed in the function definition that receives the argument.
- Operand: An object of a mathematical or logical operation, the quantity of which is defined by the operator's arity.
Noun
- the number of arguments that a function can take