Re: Assign delayed but fixed value

• To: mathgroup at smc.vnet.net
• Subject: [mg75206] Re: Assign delayed but fixed value
• From: Szabolcs <szhorvat at gmail.com>
• Date: Fri, 20 Apr 2007 00:42:06 -0400 (EDT)
• References: <f079pm\$47d\$1@smc.vnet.net>

```On Apr 19, 10:38 am, 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
>
> Istvan

Hi Istvan,

I am not sure I understand your question, but see if the below series
of commands helps you. But note that this is exactly the same as
defining var after param. There is no way of generating that table
without knowing the value of param.

Szabolcs

In[1]:=
var := var = Table[Random[Integer, {0, 3}], {param}]
param = 3;

In[3]:= ?var

Global`var
var := var = Table[Random[Integer, {0, 3}], {param}]

In[4]:= var

Out[4]= {3, 3, 1}

In[5]:= var

Out[5]= {3, 3, 1}

In[6]:= ?var

Global`var
var = {3, 3, 1}

```

• Prev by Date: set versus set-delay
• Next by Date: Re: Importing and retaining graphics
• Previous by thread: Re: Assign delayed but fixed value
• Next by thread: Re: Eliminate white border around DensityPlot?