How do I find what I think is called the "precedence" of a given operator. That is, for the following code:
CurveLength[c_Curve] := Plus @@ First /@ Cases[c, _Move]
What is the order of operations (ie. where would I apply parentheses)?
How do I find what I think is called the "precedence" of a given operator. That is, for the following code:
CurveLength[c_Curve] := Plus @@ First /@ Cases[c, _Move]
What is the order of operations (ie. where would I apply parentheses)?
{#, Precedence@#} & /@{Plus, Apply, Map}=> {{Plus, 310.}, {Apply, 620.}, {Map, 620.}}. See here.Precedenceis undocumented as far as I know – user1066 Jul 04 '20 at 18:28Operator Precedencetable – Bob Hanlon Jul 04 '20 at 18:49a @@ b /@ c. Then select something, saya, and type control-period: the whole is selected showing the expression is parsea @@ (b /@ c). Now try it another way: say, selectc. Or yet another way: select one of the operator. Control-period will extend the selection to the smallest syntactic unit containing the selection as a proper subexpression. (This is how I check when I'm uncertain.) – Michael E2 Jul 04 '20 at 21:35