2
$\begingroup$

Quoting https://reference.wolfram.com/language/ref/CellPrint.html

Cells generated by `CellPrint` by default have `GeneratedCell->True`, so that they are overwritten if they are regenerated.

An example from https://reference.wolfram.com/language/ref/Defer.html:

CellPrint[
  Function[{n}, 
    ExpressionCell[Defer[Integrate[x^n Exp[-x], {x, 0, 1}]], "Input"]]
  /@ Range[5]
]

If I put that example code in a new cell in a new notebook and excute it (shift+enter) multiple times, the ouputs are not overwritten. I expected they would be. What am I misunderstanding?

$\endgroup$
  • $\begingroup$ The "Input" option seems to override that default. Try wolfram.com/xid/0j40bj4y-da8z6e and compare it to the behavior of CellPrint[ExpressionCell[N[Pi, 20]]]. $\endgroup$ – Karsten 7. Oct 16 '15 at 16:42
  • $\begingroup$ Actually, if one uses Cell ► Show Expression, one can see that in both cases GeneratedCell->True, CellAutoOverwrite->True. $\endgroup$ – Karsten 7. Oct 16 '15 at 16:50
  • $\begingroup$ Strongly related: mathematica.stackexchange.com/q/23149/280 $\endgroup$ – Alexey Popkov Oct 16 '15 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.