Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6498
| From | David Bailey <dave@removedbailey.co.uk> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Keeping track of variables used in Mathematica |
| Date | 2011-11-17 12:03 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <ja2t79$n4u$1@smc.vnet.net> (permalink) |
| References | <ja00p0$61k$1@smc.vnet.net> |
On 16/11/2011 09:46, Dana DeLouis wrote:
>
> There was a suggestion for $NewSymbol, but I had mixed results.
I made that suggestion
> Did you or anyone else get this idea to work. Here's what I mean.
> At the top of a third workbook, the best I came up with is the following:
>
> NewNames={};
> $NewSymbol=AppendTo[NewNames,#1]&;
You could try:
If[! ValueQ[NewNames],NewNames={}]
This will only set it once, even if you re-evaluate the notebook. (BTW,
you really should avoid fully capitalised names like NewNames - such
names are reserved for future Wolfram functions).
I would also restrict the collection to global symbols:
$NewSymbol=If[#2=="Global`",AppendTo[NewNames,#1]]&;
>
> d=3;
> e=Range[4];
>
> (* Global has everything *)
>
> Names["Global`*"]
> {a,b,c,d,e,NewNames}
>
> (* But NewNames just had d& e, which seems like what we want *)
I am wondering if the other symbols were spuriously added by some
packages that get loaded in your environment. I usually pre-load some
packages, but on a bare mathematica, the Global context appears to be empty.
>
Extracting the names from the BoxForm in a notebook doesn't seem very
useful to me - because it doesn't pick up the context of symbols with an
implicit context.
David Bailey
http://www.dbaileyconsultancy.co.uk
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Keeping track of variables used in Mathematica Dana DeLouis <dana01@me.com> - 2011-11-16 09:46 +0000 Re: Keeping track of variables used in Mathematica David Bailey <dave@removedbailey.co.uk> - 2011-11-17 12:03 +0000
csiph-web