MathGroup Archive 2008

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

Search the Archive

Mixing immediate assignment and delayed assignment

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86803] Mixing immediate assignment and delayed assignment
  • From: Kristian Schmidt <kristian at kreutz.us>
  • Date: Fri, 21 Mar 2008 01:55:17 -0500 (EST)

Hello

I have some code akin to this:
In[261]:= list1 = Table[Null, {j, 1, 5}];
For[i = 1, i <= 5, i++,
 list1[[i]] := some_list[[i]];
 ]

Which after its execution will have list1 filled with these references:
{some_list[[6]], some_list[[6]], some_list[[6]], some_list[[6]], 
 some_list[[6]]}

But I would like the list to be filled with:
{some_list[[1]], some_list[[2]], some_list[[3]], some_list[[4]], 
 some_list[[5]]}

In other words, I would like the assignment of "i" to be immediate, but the assignment of some_list to be delayed, as the list will be updated periodically.

How do I achieve this? Thanks in advance.


  • Prev by Date: Mixing graphics and text
  • Next by Date: Nice Mathematica stylestyle for Book Appendix
  • Previous by thread: Re: Mixing graphics and text
  • Next by thread: Re: Mixing immediate assignment and delayed assignment