1
$\begingroup$

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)?

$\endgroup$
  • 1
    $\begingroup$ {#, Precedence@#} & /@{Plus, Apply, Map} => {{Plus, 310.}, {Apply, 620.}, {Map, 620.}}. See here. Precedence is undocumented as far as I know $\endgroup$ – user1066 Jul 4 at 18:28
  • 1
    $\begingroup$ See Operator Precedence table $\endgroup$ – Bob Hanlon Jul 4 at 18:49
  • 1
    $\begingroup$ Type a @@ b /@ c. Then select something, say a, and type control-period: the whole is selected showing the expression is parse a @@ (b /@ c). Now try it another way: say, select c. 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.) $\endgroup$ – Michael E2 Jul 4 at 21:35
  • 1
    $\begingroup$ Does this answer your question? What are some useful, undocumented Mathematica functions? $\endgroup$ – C. E. Jul 5 at 7:33
  • $\begingroup$ I’m voting to close this question because questions concerning the operation of Wolfram|Alpha are explicitly excluded from being considered on this site. $\endgroup$ – m_goldberg Jul 5 at 16:28

Browse other questions tagged or ask your own question.