Re: Assign delayed but fixed value
- To: mathgroup at smc.vnet.net
- Subject: [mg75190] Re: [mg75168] Assign delayed but fixed value
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Fri, 20 Apr 2007 00:33:53 -0400 (EDT)
- References: <200704190831.EAA04122@smc.vnet.net>
The way to do what you want is to make a delayed assignment to the OwnValues of var that overwrites itself on execution. (MMA 5.2 Kernel) In[1]:= var:=var=Table[Random[Integer,{0,3}],{param}]; param=3; (MMA 5.2 Kernel) In[3]:= ?var Global`var var:=var=Table[Random[Integer,{0,3}],{param}] (MMA 5.2 Kernel) In[4]:= var (MMA 5.2 Kernel) Out[4]= {0,0,0} (MMA 5.2 Kernel) In[5]:= ?var Global`var var={0,0,0} (MMA 5.2 Kernel) In[6]:= var (MMA 5.2 Kernel) Out[6]= {0,0,0} On 4/19/07, zac <replicatorzed at gmail.com> wrote: > Dear Group! > > My target is to define the value of 'var' in terms of the value of > 'param'. The problem is that 'param' is introduced later than 'var', > and this time-sequence cannot be changed. However, I would like to > create 'var' such a way that IF 'param' is known, the value of 'var' > should be the same any time it is called. > Example code: > > In[1]:= > var = Table[Random[Integer,{0,3}],{param}]; > param = 3; > > >From In[1]:= Table::iterb : Iterator {param} does not have appropriate > bounds. More... > > In[3]:= > var > > Out[3]= > {1,1,3} > > In[4]:= > var > > Out[4]= > {0,3,1} > > > The Table::iterb message is a secondary matter, as the two 'var' > outputs do not equal, and this is my primary concern. Any idea how to > solve this task? Thanks in advance. > > Istvan > > > -- http://chris.chiasson.name/
- References:
- Assign delayed but fixed value
- From: zac <replicatorzed@gmail.com>
- Assign delayed but fixed value