0
$\begingroup$

I have a cell:

Unprotect[Plus];

followed by a cell:

Plus[label[t1_, l1_], label[t2_, l1_]] := label[t1 + t2, l1]

If I give the notebook the command "evaluate initialization cells" sometimes this fails as the second cell gets evaluated before the first. I would like an initialization command where the default order of evaluation is the order of definition. Or is there some other solution recommended for this problem?

$\endgroup$
  • 2
    $\begingroup$ I would be very surprised if the cells are not evaluated one after the other in the order given in the notebook (i.e. top down). Unless you are doing something with parallel kernels and such. $\endgroup$ – Nasser Apr 26 at 5:43
  • $\begingroup$ oh, maybe it was because I had another kernel turned on. Tough I'm not doing anything "explicitly" parallel. $\endgroup$ – user3257842 Apr 26 at 5:54
  • $\begingroup$ Why couldn't you put both definitions in one cell? $\endgroup$ – J. M.'s technical difficulties Apr 26 at 6:06
  • $\begingroup$ I actually did do that. But now I'm uncertain as to whether any other parts of the program might be vulnerable to out-of-order initialization bugs. $\endgroup$ – user3257842 Apr 26 at 6:12

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.