# NestList: How to have a parameter that is changing as a function of nest index, n?

I have a NestList construction

NestList[STEP[#] &, m0, NT]


where a function is being called repeatedly that acts on a list and returns a list, for details, see here.

Let NT in the NestList denote a discrete time, and let's say I'd like to have a parameter that is passed to the STEP function as a function of discrete time.

In other words, I'd like to pass a parameter temperature that's like:

temperature = Table[ii/NT,{ii,1,NT}]


to my STEP function through NestList.

I am sure there is an easy way to do this, but I can't seem to figure it out.

• Try FoldList[STEP[#, #2] &, m0, Table[ii/NT, {ii, 1, NT}] ]? – kglr Jul 14 '19 at 6:10
• This worked like a charm ... Thank you ! – YNSBRYR Jul 14 '19 at 6:40

You can use FoldList:
FoldList[STEP[#, #2] &, m0, Table[ii/NT, {ii, 1, NT}] ]