Mathematica 9 is now available

Stack

Usage

Stack[ ] 显示当前计算堆栈,并返回与当前正进行的计算相联系的标记列表.
Stack[pattern] 返回当前正进行计算并与指定模式匹配的表达式列表.


Notes

Stack[_] 显示当前正被计算的表达式.
• 你可以在一个对话的内部调用Stack来查看对话进行的方式.
• 由Stack[pattern]返回的列表中, 每个表达式都被HoldForm包装.
Stack[ ] 的最大长度受$RecursionLimit的限制.
Stack 具有属性 HoldFirst.
• 参见Mathematica 全书: 2.5.11节.
• 同时参见: Trace.
Further Examples

Stack[_] gives the expressions that are being evaluated at the time when it is called, in this case including the Print function.

In[1]:=  


Stack gives the tags associated with the evaluations that are being done when it is called.

In[2]:=  


Here is the standard recursive definition of the factorial function.

In[3]:=  

This evaluates fac[10], starting a dialog when it encounters fac[4].

In[4]:=  

Out[5]=

This shows what objects were being evaluated when the dialog was started.

In[5]:=  

Out[6]=

This ends the dialog.

In[6]:=  

Out[4]=

StackInhibit prevents Print from being included on the stack.

In[7]:=  


StackBegin[expr] uses a fresh stack in the evaluation of expr.

In[8]:=  


Out[6]=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.