MathGroup Archive 1997

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

Search the Archive

names, symbols, and contexts

  • To: mathgroup at
  • Subject: [mg6175] names, symbols, and contexts
  • From: murray at (Murray Eisenberg)
  • Date: Thu, 27 Feb 1997 02:52:23 -0500
  • Sender: owner-wri-mathgroup at

Here's the problem:  a symbol fname contains the name of a Mathematica
object, e.g.:

   fname = "myf"

The question is how to determine the context of the object named by
fname (in our case, the context of myf).

The question comes down to how to torture fname in order to supply the
result as argument to Context.  

I've tried all sorts of combinations of SymbolName, ToExpression, and
ToString, but Mathematica keeps complaining  -- error message is
Context::ssle : Symbol, string, or HoldPattern[symbol] expected at
position 1 in Context[...].

There's something I'm missing.

(Like many such things, this one is trivial to do in APL or J; I'm
just not "getting it" how to do the same thing in Mathematica.)

  Murray Eisenberg                       Internet:  murray at
  Mathematics & Statistics Dept.            Voice:  413-545-2859 (W)
  University of Massachusetts                       413-549-1020 (H)
  Amherst, MA 01003                           Fax:  413-545-1801

  • Prev by Date: Re: Solving non-linear equations
  • Next by Date: contexts,packages,names: again!
  • Previous by thread: global names in contexts
  • Next by thread: Re: names, symbols, and contexts