MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Evaluating Global Variables Named Strings as

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105499] Re: [mg105465] Evaluating Global Variables Named Strings as
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sat, 5 Dec 2009 05:34:06 -0500 (EST)
  • Reply-to: hanlonr at cox.net

Grid[
 a = {#, ToExpression[#]} & /@
   {"$AddOnsDirectory", 
    "$BaseDirectory"},
 Spacings -> {1.5, 1.5}]

Column[Flatten[
  a = {#, ToExpression[#]} & /@
    {"$AddOnsDirectory", 
     "$BaseDirectory"}],
 Spacings -> 1.5]


Bob Hanlon

---- BenT <brtubb at pdmusic.org> wrote: 

=============
Consider the output of this:

a=Names["System`$*"]

How does one then process/evaluate each String element of the
resulting List, as the global function name which it represents?

For a more direct (simpler) example: if given

a={$AddOnsDirectory,$BaseDirectory}

Then this output is obtained.

{C:\Documents and Settings\All Users\Application Data\Mathematica,C:
\Documents and Settings\All Users\Application Data\Mathematica}

However what I really want to be able to do is process "a" somehow so
that I get the effect of multiple Input cells with their corresponding
Output cells displayed, namely:

$AddOneDirectory

C:\Documents and Settings\All Users\Application Data\Mathematica

$BaseDirectory

C:\Documents and Settings\All Users\Application Data\Mathematica

How is this achieved?

--- Benjamin Tubb



  • Prev by Date: Re: Flatten alternative
  • Next by Date: Re: Evaluating Global Variables Named Strings as Variables
  • Previous by thread: Foldlist with more than one list as argument
  • Next by thread: Re: Evaluating Global Variables Named Strings as