Possible Duplicate:
How do I clear all user defined symbols?

During package development things get messed up quite often. (especially when playing with notations)

Is there a simple way to reset MMA from within a notebook (Maple has "Restart")?

  • 1
    $\begingroup$ If you use the Workbench you can run in Debug mode and then restarting the kernel is very convenient. Besides if you change definitions, add more code (or fix it) etc. the changes are immediately available - the workbench does the job for you. $\endgroup$ – b.gates.you.know.what Oct 2 '12 at 14:18
  • $\begingroup$ Within the notebook, just type Exit[]. $\endgroup$ – Mark McClure Oct 2 '12 at 14:19
  • $\begingroup$ You may want to chek this question and answers therein. This probably won't help you with notation however. $\endgroup$ – Leonid Shifrin Oct 2 '12 at 14:22
  • 2
    $\begingroup$ This is also related : mathematica.stackexchange.com/questions/850/… $\endgroup$ – Artes Oct 2 '12 at 14:31
  • $\begingroup$ @b.gatessucks : THX, did not know about that fact. Tried the workbench again, works fine with code-changes. This is the way to go. $\endgroup$ – NoEscape Oct 3 '12 at 9:50

Like acl says, Quit[] kills the kernel, as does its synonym Exit[]. The complete internal state will be lost. When the MathKernel process isn't running, it is automatically restarted when you press Shift+Enter to evaluate an input line.

  • $\begingroup$ Your last sentence implies that the kernel is restarted every time an input line is executed. Did you mean to imply that? $\endgroup$ – rcollyer Oct 2 '12 at 14:28
  • $\begingroup$ @rcollyer - er, no, obviously :-/. I fixed it. Thanks for the feedback. $\endgroup$ – stevenvh Oct 2 '12 at 14:30
  • $\begingroup$ So i still have to execute a cell containing Exit[], go to another cell containing <<"MyPackage`" and some tests. Can this be shortened? Putting Exit[] and <<"MyPackage`" in the same is not working. $\endgroup$ – NoEscape Oct 2 '12 at 15:21
  • $\begingroup$ putting Exit[] in the .m file is also not a good idea!? $\endgroup$ – NoEscape Oct 2 '12 at 15:25
  • 1
    $\begingroup$ @NoEscape - The kernel will execute the input line left to right, so when it encounters Exit[], the kernel is killed, and then all other instructions from that input are lost. Same with the .m file. When you kill the kernel all you have left is the user interface, no execution of any kind. You could have the <<MyPackage on a separate input line. That input will be retained, but not automatically executed. So after you executed the Exit[] command, just select that line and press Shift+Enter $\endgroup$ – stevenvh Oct 2 '12 at 15:33

How about Quit[]/Exit[], which kills the kernel?

  • $\begingroup$ There are also ways to save and reload state, but I doubt they'd work reliably if you are doing package development (and thus manipulating contexts), not to mention the notation stuff. $\endgroup$ – acl Oct 2 '12 at 14:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.