Re: priorities between @, @@ and //
- To: mathgroup at smc.vnet.net
- Subject: [mg108764] Re: priorities between @, @@ and //
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Tue, 30 Mar 2010 05:03:50 -0500 (EST)
- References: <hoq5va$25l$1@smc.vnet.net>
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