Replacement in a held function
- To: mathgroup at smc.vnet.net
- Subject: [mg113295] Replacement in a held function
- From: István Zachar <zac at freemail.hu>
- Date: Fri, 22 Oct 2010 01:36:57 -0400 (EDT)
Dear Group,
How can the following toy example be modified to yield {1, 2, 3}
instead of {t, t, t}? Suppose func, t and list are given parameters
that cannot be changed, so I want to solve it with some kind of
argument-replacement-inside-the-loop method. Thus I'm looking for a
solution which only manipulates the internals of Do. If it is possible
at all.
In[104]:= list = {};
func := AppendTo[list, t];
Do[func /. {t -> i}, {i, 3}];
list
Out[107]= {t, t, t}