|
In logic, mathematics, and computer science, the arity of a function or operation is the number of arguments or operands the function or operation accepts. The arity of a relation (or predicate) is the dimension of the domain in the corresponding Cartesian product. (A function of arity ''n'' thus has arity ''n''+1 considered as a relation.) The term springs from words like unary, binary, ternary, etc. Unary functions or predicates may be also called "monadic"; similarly, binary functions may be called "dyadic". In mathematics arity may also be named ''rank'', but this word can have many other meanings in mathematics. In logic and philosophy, arity is also called ''adicity'' and ''degree''. In linguistics, arity is usually named ''valency''. In computer programming, there is often a syntactical distinction between operators and functions; syntactical operators usually have arity 0, 1, or 2. Functions vary widely in the number of arguments, though large numbers can become unwieldy. Some programming languages also offer support for variadic functions, i.e., functions syntactically accepting a variable number of arguments. ==Examples== The term "arity" is rarely employed in everyday usage. For example, rather than saying "the arity of the addition operation is 2" or "addition is an operation of arity 2" one usually says "addition is a binary operation". In general, the naming of functions or operators with a given arity follows a convention similar to the one used for ''n''-based numeral systems such as binary and hexadecimal. One combines a Latin prefix with the -ary ending; for example: * A nullary function takes no arguments. * A unary function takes one argument. * A binary function takes two arguments. * A ternary function takes three arguments. * An ''n''-ary function takes ''n'' arguments. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Arity」の詳細全文を読む スポンサード リンク
|