3
$\begingroup$
In[1] A=Range[10^4];?A

Out[1] (* definition of  A*)

enter image description here

It works for 10^4. But if I increase the number to 10^6

In[1] A=Range[10^6];?A (* Do not try this *)

makes my PC freezed. It is even impossible to abort. The only way out is quitting mathematica without saving documents.

While I was writing this article, I recalled the command Definition. Definition[A] doesn't make such problem.

enter image description here

Then my question was changed. What is advantage/disadvantage of ? and Definition?

$\endgroup$
3
  • $\begingroup$ It takes about 4 minutes to show up on my machine for 10^6. Win7-Mma12.2. After that pressing Home and End keys is also sluggish. I have deleted my prev. comment that said that it hangs my computer. I decided to wait longer just to see. I think "? " should be used for function definitions, but there could be more options to discover. $\endgroup$
    – Syed
    Aug 29, 2021 at 12:07
  • $\begingroup$ ? writes out the entire list. Definition[] shows the Short version of the range and it takes roughly a minute on my machine. $\endgroup$
    – Syed
    Aug 29, 2021 at 12:12
  • 3
    $\begingroup$ The problem is the FrontEnd (notebook interface) trying to format long expression. Unfortunately the problem has a long history (try Do[Print[i],{i,10000}] or TracePrint something not trivial). I personally experimented with substituting $Output stream with something limiting the amount of the output. WRI seem to be surely aware of the problem and is moving towards multithreaded FE (which will at least give you a chance to abort) but we're not there yet. $\endgroup$ Aug 29, 2021 at 14:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.