0

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")?

NoEscape
  • 842
  • 4
  • 14

2 Answers2

4

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.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
stevenvh
  • 6,866
  • 5
  • 41
  • 64
  • Your last sentence implies that the kernel is restarted every time an input line is executed. Did you mean to imply that? – rcollyer Oct 02 '12 at 14:28
  • @rcollyer - er, no, obviously :-/. I fixed it. Thanks for the feedback. – stevenvh Oct 02 '12 at 14:30
  • So i still have to execute a cell containing Exit[], go to another cell containing <<"MyPackage\"and some tests. Can this be shortened? PuttingExit[]and<<"MyPackage`"` in the same is not working. – NoEscape Oct 02 '12 at 15:21
  • putting Exit[] in the .m file is also not a good idea!? – NoEscape Oct 02 '12 at 15:25
  • 1
    @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 – stevenvh Oct 02 '12 at 15:33
3

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

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
acl
  • 19,834
  • 3
  • 66
  • 91
  • 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. – acl Oct 02 '12 at 14:29