MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: priorities between @, @@ and //

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108748] Re: priorities between @, @@ and //
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 30 Mar 2010 05:00:49 -0500 (EST)

To find out, evaluate the expressions.

f@x // g

g[f[x]]

f @@ {a, b}[[2]]

b

For the precedence of operators see :

http://reference.wolfram.com/mathematica/tutorial/OperatorInputForms.html

@ has higher precedence than //

[[ ]] has higher precedence than @@
However, this makes no difference for the last example above

(f @@ {a, b})[[2]] == f @@ ({a, b}[[2]])

True

And if you want to make sure, use parentheses to force the evaluation order. 


Bob Hanlon

---- guerom00 <guerom00 at 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 :)




  • Prev by Date: Re: priorities between @, @@ and //
  • Next by Date: Re: priorities between @, @@ and //
  • Previous by thread: Re: priorities between @, @@ and //
  • Next by thread: Re: priorities between @, @@ and //