MathGroup Archive 2007

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

Search the Archive

Re: Variable containing code

  • To: mathgroup at
  • Subject: [mg74962] Re: [mg74937] Variable containing code
  • From: Daniel Huber <dh at>
  • Date: Fri, 13 Apr 2007 01:57:38 -0400 (EDT)
  • References: <> <>

Hallo Carl,
thank's a lot. I knew that there is some magic word around but I was not 
able  to find it.
However, this only solves half the problem. If I try:
Set[ t2, Extract[OwnValues[t1],{1,2},Unevaluated] ];
t2 does not evaluate the code, the reason is:
Although OwnValues[t1] and OwnValues[t2] return similar results, 
Information (??) returns different results, namely: t1:=Print[Hello] and 
It looks like Set did not strip the "Unevaluated". Does Set not behave 
like a normal function?

Carl Woll wrote:
> dh wrote:
>> Hello,
>> how can one get at the value of a variable if this value is executable
>> code? E.g. consider variable t1:= Print["Hello"]. How can I set the
>> value of a second variable t2 to the value of t1 without executing 
>> the code?
>> Daniel
> Try OwnValues[t1]
> Carl Woll
> Wolfram Research


Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh at>

  • Prev by Date: Re: About Table
  • Next by Date: Re: About Table
  • Previous by thread: RE: Variable containing code
  • Next by thread: Re: Variable containing code