其他分享
首页 > 其他分享> > OCaml之function函数与operator运算符间有趣的联系

OCaml之function函数与operator运算符间有趣的联系

作者:互联网

A function is treated syntactically as an operator if the name of that function is chosen from one of a specialized set of identifiers. This set includes identifiers that are sequences of characters from the following set:
! $ % & * + - . / : < = > ? @ ^ |

as long as the first character is not ~, !, or $.

There are also a handful of predetermined strings that count as infix operators, including mod, the modulus operator, and lsl, for “logical shift left,” a bit-shifting operation.

| The syntactic role of an operator is typically determined by its first character or two, though there are a few exceptions. The list below breaks the different operators and other syntactic forms into groups from highest to lowest precedence, explaining how each behaves syntactically. We write !… to indicate the class of operators beginning with !.https://dev.realworldocaml.org/variables-and-functions.html

标签:function,set,syntactic,operators,character,OCaml,运算符,operator
来源: https://www.cnblogs.com/zc007/p/15714739.html