Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

names, symbols, and contexts

  • To: mathgroup at smc.vnet.net
  • Subject: [mg6175] names, symbols, and contexts
  • From: murray at math.umass.edu (Murray Eisenberg)
  • Date: Thu, 27 Feb 1997 02:52:23 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

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 math.umass.edu
  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