Why do I have to evaluate this twice?

前端 未结 1 352
野趣味
野趣味 2020-12-14 19:59

I cannot figure out why I have to evaluate this twice (in Mathematica 7) for the assignment to take.

First evaluation:

Unprotect[Rule];
Attributes[Ru         


        
相关标签:
1条回答
  • 2020-12-14 20:33

    As you might well know, Mathematica loads binary MX files that implement some of its functionality. These MX files store implementations as well as definitions and attributes.

    This is insidious, but your Unprotect[Rule] is undone by Mathematica's newly loaded MX file, and this explains why it worked the second time. Because Mathematica had already loaded all MX files it needed.

    If you first evaluate all the symbols in your expression, then it stops complaining:

    {Unprotect, Rule, Attributes, Plot, LogLinearPlot, ListPlot, 
      ParametricPlot3D, True, False, Print};
    Unprotect[Rule];
    Attributes[Rule];
    pp = Plot | LogLinearPlot | ListPlot | ParametricPlot3D;
    (h : pp)[True -> False] ^:= Print["Irrelevant data"]
    

    EDIT The first evaluation is needed to trigger all the auto-loading before you unprotect Rule.

    0 讨论(0)
提交回复
热议问题