MathGroup Archive 2010

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

Search the Archive

Re: Replacement in a held function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113306] Re: Replacement in a held function
  • From: Roger Wilson <rogerhw999 at gmail.com>
  • Date: Sat, 23 Oct 2010 07:04:32 -0400 (EDT)
  • References: <i9r81q$hq2$1@smc.vnet.net>

Something like this...

list = {};
func := AppendTo[list, t];
Do[Block[{t = i}, func], {i, 3}];
list


On 22 Oct, 06:39, Istv=E1n Zachar <z... at freemail.hu> wrote:
> 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}



  • Prev by Date: Re: From list to list of arguments
  • Next by Date: Re: Replacement in a held function
  • Previous by thread: Re: Replacement in a held function
  • Next by thread: Re: Replacement in a held function