Prev: Resolution Time Study
Next: if with two conditions
From: dh on 30 Mar 2010 06:02 Hi, you nay find a listing of precedences in the Help under: tutorial/OperatorInputForms Daniel On 29.03.2010 14:20, guerom00 wrote: > Hello all, > > Just a quick question : what are the priority between all those > operators ? I mean : > - what is f@x//g ? Is it f[g[x]] or g[f[x]] > - what is f@@{a,b}[[2]] ? Is it f[b] or (f[a,b])[[2]] > > You see what I mean... What are the rules for the priority of all > those operators ? > > TIA :) > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail:<mailto:dh(a)metrohm.com> Internet:<http://www.metrohm.com>
From: guerom00 on 30 Mar 2010 06:02 Thank you for all the responses :)
From: Norbert Marxer on 30 Mar 2010 06:03 On Mar 29, 2:20 pm, guerom00 <guero...(a)gmail.com> wrote: > Hello all, > > Just a quick question : what are the priority between all those > operators ? I mean : > - what is f@x//g ? Is it f[g[x]] or g[f[x]] > - what is f@@{a,b}[[2]] ? Is it f[b] or (f[a,b])[[2]] > > You see what I mean... What are the rules for the priority of all > those operators ? > > TIA :) Hello Enter "tutorial/OperatorInputForms" in the text field in the Help Documentation Center, hit return and scroll down to a long table which gives you the precedence of all the operators. A quick way to find out is also: select a symbol in the middle of your expression, press "Ctrl ." and you will see whether Mathematica binds to the left or right. Best Regards Norbert Marxer
From: Albert Retey on 30 Mar 2010 06:03
Am 29.03.2010 14:20, schrieb guerom00: > Hello all, > > Just a quick question : what are the priority between all those > operators ? I mean : > - what is f@x//g ? Is it f[g[x]] or g[f[x]] > - what is f@@{a,b}[[2]] ? Is it f[b] or (f[a,b])[[2]] > > You see what I mean... What are the rules for the priority of all > those operators ? > > TIA :) > I think that this is all documented somewhere, unfortunately its not that easy to find. On the other hand I hardly ever find it necessary to look that stuff up, thanks to FullForm I will always get the actual rules shown, including not only undocumented features but also potential bugs :-) FullForm[f@x//g] FullForm[Hold[f@@{a,b}[[2]]]] If in doubt, I usually use the explicit function names and not the shortcuts, that is Apply instead of @@ and [] instead of @ or // and Map instead of /@ . Using the longer FullForm-Syntax always makes the priorities explicit, which I often like better than saving a few letters/keystrokes... hth, albert |