How to make an analog of InString[]?

后端 未结 3 1774
独厮守ぢ
独厮守ぢ 2021-01-20 05:59

I have discovered that InString[] does not work in MathLink mode when sending input with EnterExpressionPacket header. So I need to de

3条回答
  •  灰色年华
    2021-01-20 06:15

    I just have found simpler but dangerous way:

    In[3]:= Unevaluated[2 + 2]
    Trace[In[$Line - 1]] // Last
    Trace[In[$Line - 1]] // Last
    
    Out[3]= Unevaluated[2 + 2]
    
    Out[4]= Unevaluated[2 + 2]
    
    During evaluation of In[3]:= $RecursionLimit::reclim: Recursion depth of 256 exceeded. >>
    
    During evaluation of In[3]:= $RecursionLimit::reclim: Recursion depth of 256 exceeded. >>
    
    During evaluation of In[3]:= $IterationLimit::itlim: Iteration limit of 4096 exceeded. >>
    
    Out[5]= Hold[In[$Line-1]]
    

    Does anybody know a way to make it safe?

提交回复
热议问题