What can internally be happening here? Is the evaluator just messing with us and going non-standard because it's a Bag
? Or am I just not seeing how something like this could be done in Mathematica?
AppendTo[$ContextPath, "Internal`"];
In[19]:= ClearAll[x, y];
{x, y} = {Bag[{1, 2, 3}], Bag[{4, 5}]};
Heads are
In[21]:= Head /@ {x, y}
Out[21]= {Bag, Bag}
But they are just a head, no depth. Depths
In[22]:= Depth /@ {x, y}
Out[22]= {1, 1}
However, they are different. I take their second elements, or I print them in InputForm
In[23]:= BagPart[#, 2] & /@ {x, y}
InputForm /@ {x, y}
Out[23]= {2, 5}
Out[24]= {InputForm[Internal`Bag[{1, 2, 3}]], InputForm[Internal`Bag[{4, 5}]]}