Stack

Stack[]
shows the current evaluation stack, giving a list of the tags associated with evaluations that are currently being done.

Stack[pattern]
gives a list of expressions currently being evaluated which match the pattern.

DetailsDetails

  • Stack[_] shows all expressions currently being evaluated.
  • You can call Stack from inside a dialog to see how the dialog was reached.
  • In the list returned by Stack[pattern], each expression is wrapped with HoldForm.
  • The maximum length of Stack[] is limited by $RecursionLimit.
  • Stack has attribute HoldFirst.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Print the stack where the Stack command is being evaluated:

In[1]:=
Click for copyable input
Out[1]=

Print the detailed stack contents including function arguments:

In[1]:=
Click for copyable input
Out[1]=
New in 2
New to Mathematica? Find your learning path »
Have a question? Ask support »