The Order of Precedence of Programming Language Operators
DescriptionOperator Precedence Examples
<Text-field style="Heading 2" layout="Heading 2" bookmark="info">Description</Text-field>
The order of precedence of all Maple programming language operators is as follows, from highest to lowest binding strengths:
(on the right):-(left associative)||(left associative)(on the left):-(left associative)(on the right)::(non-associative)(on the left)postfix ++ and --(left-associative)(on the right)prefix ++ and --(right-associative)&-operators (except &*)(left associative)&&-operators(right associative)!(left associative)^, @@, %^(non-associative)., *, &*, /, @, intersect, %., %*, %/(left associative)(on the right)mod(non-associative)+, -, union, minus, %+, %-(left associative)(on the left)mod(non-associative).., subset(non-associative)<, <=, >, >=, =, <>, in(non-associative)$(non-associative)not(right associative)and(left associative)or(left associative)xor(left associative)implies(non-associative)->(right associative),(left associative)assuming(left associative):=, +=, -=, *=, .=, /=, mod=, ^=, ,=, ||=, and=, or=, xor=, implies=, union=, intersect=, minus=(non-associative)
Note that LUklbXJvd0c2JEkqcHJvdGVjdGVkR0YlL0krbW9kdWxlbmFtZUc2IkksVHlwZXNldHRpbmdHNiRGJUkoX3N5c2xpYkdGKDYjLUkjbW9HNiRGJS9GJ0YpNiNRIl5GKA== and LUklbXJvd0c2JEkqcHJvdGVjdGVkR0YlL0krbW9kdWxlbmFtZUc2IkksVHlwZXNldHRpbmdHNiRGJUkoX3N5c2xpYkdGKDYkLUkjbW9HNiRGJS9GJ0YpNiNRIkBGKEYt are defined to be non-associative and therefore a^b^c is invalid in Maple. (Parentheses must be used.)
Note that the precedence of mod is different on the right than on the left. (See examples.)
The evaluation of expressions involving the logical operators proceeds in an intelligent manner which exploits more than the simple associativity and precedence of these operators. Namely, the left operand of the operators and, or, xor, and implies is always evaluated first and the evaluation of the right operand is avoided if the truth value of the expression can be deduced from the value of the left operand alone.
The module member selection operator LUklbXJvd0c2JEkqcHJvdGVjdGVkR0YlL0krbW9kdWxlbmFtZUc2IkksVHlwZXNldHRpbmdHNiRGJUkoX3N5c2xpYkdGKDYkLUkjbW9HNiRGJS9GJ0YpNiNRKCZjb2xvbjtGKC1GLjYjUSgmbWludXM7Rig= has special rules for simplification and evaluation. It is simplified immediately and automatically to the local instance of the module member name that it denotes. It is not possible to manipulate an LUklbXJvd0c2JEkqcHJvdGVjdGVkR0YlL0krbW9kdWxlbmFtZUc2IkksVHlwZXNldHRpbmdHNiRGJUkoX3N5c2xpYkdGKDYkLUkjbW9HNiRGJS9GJ0YpNiNRKCZjb2xvbjtGKC1GLjYjUSgmbWludXM7Rig= expression as a compound data structure. The expression appearing to the left of the LUklbXJvd0c2JEkqcHJvdGVjdGVkR0YlL0krbW9kdWxlbmFtZUc2IkksVHlwZXNldHRpbmdHNiRGJUkoX3N5c2xpYkdGKDYkLUkjbW9HNiRGJS9GJ0YpNiNRKCZjb2xvbjtGKC1GLjYjUSgmbWludXM7Rig= operator must evaluate to a module (it is an error, otherwise), and the symbol appearing to the right of the LUklbXJvd0c2JEkqcHJvdGVjdGVkR0YlL0krbW9kdWxlbmFtZUc2IkksVHlwZXNldHRpbmdHNiRGJUkoX3N5c2xpYkdGKDYkLUkjbW9HNiRGJS9GJ0YpNiNRKCZjb2xvbjtGKC1GLjYjUSgmbWludXM7Rig= operator must be the name of an exported member of that module.
The precedence of elementwise operators matches that of the operator being applied element-wise.
See Alsooperator