MathGroup Archive 1999

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

Search the Archive

Re: another set of global variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16830] Re: another set of global variables
  • From: tobiasoed at my-dejanews.com
  • Date: Tue, 30 Mar 1999 02:35:26 -0500
  • Organization: Deja News - The Leader in Internet Discussion
  • Sender: owner-wri-mathgroup at wolfram.com

Adelbert, this seems to be what your looking for:

SetAttributes[PushGlobal,HoldAll]

PushGlobal[vars___]:=Module[{varnames=ReleaseHold[Map[ToString,Map[Unevaluated,Hold[{vars}],{2}],{2}]]},
	Begin["PseudoGlobal`"];
	$ContextPath=Complement[$ContextPath,{"Global`"}];
	MapThread[Set,{Map[Symbol,varnames],{vars}}];
]

PseudoGlobal`PopGlobal[]:=(
	Scan[Remove[#]&,Names["PseudoGlobal`"]];
	PrependTo[$ContextPath,"Global`"];
	Begin["Global`"];
)

Nb: all Pushed variables get copied into the new context.
As it is this is not to be reentered: no to PushGlobal after
oneanother.
Hope it helps Tobias.


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


  • Prev by Date: RE: Plotting multiple outputs from cpu intensive functi
  • Next by Date: Re: Equation numbers
  • Previous by thread: another set of global variables
  • Next by thread: Coefficients in expressions