I have a confusion with the Apply function. The Apply function replaces the head of an expression at the desired level. For example:

In[124]:= Apply[Superscript, {{2, 3}}, {1}]

Out[124]= {Superscript[2,3]}

On the other hand the operator @@@ is equivalent to Apply acting at level {1} :

In[125]:= Superscript @@@ {{2, 3}}

Out[125]= {Superscript[2,3]}

However the level {1} of the expression is not an argument for Superscript:

In[126]:= Level[{{2, 3}}, {1}]

Out[126]= {{2, 3}}

In[127]:= FullForm[%]


Since :

In[131]:= Superscript[List[2, 3]]

Out[131]= Superscript[{2, 3}]

So it is as if the operator @@@ is acting at level {2}

In[129]:= Level[{{2, 3}}, {2}]

Out[129]= {2, 3}

In[130]:= FullForm[%]


and so replacing the head in the last expression is the same as :

In[132]:= Superscript[2, 3]

Out[132]= Superscript[2,3]

What is happening here?


closed as off-topic by m_goldberg, b.gates.you.know.what, C. E., Henrik Schumacher, José Antonio Díaz Navas Feb 18 '18 at 20:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, b.gates.you.know.what, C. E., Henrik Schumacher, José Antonio Díaz Navas
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ Level returns a list. Try Level[x[{1, 2}], {1}] to understand. $\endgroup$ – Szabolcs Feb 17 '18 at 20:33
  • 3
    $\begingroup$ "Apply replaces heads in parts of expr specified by levelspec" not "replaces the head of an expression". So it relaces heads in each of expressions in Level[{{2, 3}}, {1}] as it returns a list by default. Perhaps using different heads will be clearer $\endgroup$ – Kuba Feb 17 '18 at 20:34
  • 2
    $\begingroup$ @Szabolcs: Thankx!, I now understand my confusion: I was not interpreting correctly the output of Level, which is always a list. $\endgroup$ – Gluoncito Feb 17 '18 at 20:43
  • $\begingroup$ @Kuba: thankx ! $\endgroup$ – Gluoncito Feb 17 '18 at 20:43