Re: Creating a simple state inspector for Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg111857] Re: Creating a simple state inspector for Mathematica
- From: magma <maderri2 at gmail.com>
- Date: Sun, 15 Aug 2010 07:39:33 -0400 (EDT)
- References: <email@example.com>
On Aug 14, 12:35 pm, "J. McKenzie Alexander" <ja... at lse.ac.uk> wrote: > Hi, > > I'm trying to create a simple "state inspector" for Mathematica. Ideally, > I'd like to have a dynamically updated list of all the symbols in Global`= , > with the option of displaying their values, and the ability to Clear o= r Remove symbols by clicking on a button. Now, I've managed to put together= something which *almost* does what I want, but it has a slight bug. What's= the bug? You can Clear a symbol by clicking on the button named "Clear", b= ut clicking on the button named "Remove" generates an error. I don't unders= tand why. the command Remove is very nasty! I would not recommend anybody using it in a program (that is a sequence of steps running ). One should only use it directly, that is typing it by hand, if at all. The reason is that when you remove a symbol (say x), a sort of shadow or ghost lingers in memory and is called Removed[x] and all definitions (in Set, SetDelayed and elsewhere) are modified in such a way that occurrences of x are replaced with Removed[x], practically making them unusable by Mathematica again, even if you give x a value again. So, I would simply NOT use Remove in your inspector. Clear or ClearAll is enough for most reasonable things.