Re: Display Workspace
- To: mathgroup at smc.vnet.net
- Subject: [mg112336] Re: Display Workspace
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Fri, 10 Sep 2010 04:47:13 -0400 (EDT)
- References: <i6a5fq$kkt$1@smc.vnet.net>
Hi, > Is there a way to dynamically display and update all currently defined > global variables and their values/definitions? You could try something along these lines: $NewSymbol = Function[ GlobalInspector`trigger = AbsoluteTime[]] GlobalInspector`trigger = AbsoluteTime[] CreateDialog[Dynamic[ GlobalInspector`trigger; Grid[{#, ToExpression[#, InputForm, Function[Null, InputField[Dynamic[#], ImageSize -> 500], HoldFirst]]} & /@ Names["Global`*"], Alignment -> Left], TrackedSymbols :> {GlobalInspector`trigger}]] it has some deficiencies, though: there is no way that I know of to update when a variable is removed with Remove (you could use a fixed UpdateInterval, but that also might have implications). Another problem is that a Remove will actually not Remove anymore, since the symbols are still existing in the Dynamics. Of course the appearance and behaviour of the dialog is also not very elaborated. > Im trying to come up with some code to that will emulate the > "Workspace" window in another system's session, but I am having difficulty > getting it to work. If you are relatively new to Mathematica, an inspector for global variables is not something that is very simple to program and as mentioned might even have some conceptual problems. I don't know whether it is my background in Mathematica, but such an inspector is not a feature that I miss very much in Mathematica, why do you think it is so important to have it? Interacting with Mathematica means typing commands, there is no way to completely avoid it. And in spite of all the screen fondling enthusiasm these days for many tasks typing still is the most efficient way to interact with a computer. Considering this it is often much more efficient to just do ?variablename to see whether a variable exists or not and what value it has and variablename = 1 to set it than to switch to another window, search the variable, click there and edit an input field. If you are afraid of all the typing, I would like to mention the "Complete Selection" menu entry which has a keyboard shortcut (Ctrl-K on Windows) which saves you from many keystrokes and typos. Note that what is called "Workspace" in the other system is known as "Namespace" in general and as "Context" in Mathematica. hth, albert