Reading in the doc, it is mentioned in the example of Dynamic
that this way of writing the code does not work:
data = {.1, .5, .3, .9, .2};
Table[Slider[Dynamic[data[[i]]]], {i, 5}]
The reason is because Dynamic
is HoldFirst
.
Now is that really the reason? look at this:
Clear[f]
SetAttributes[f, HoldFirst]
f[x_] := g[x]
Table[f[i], {i, 5}]
(*{g[1], g[2], g[3], g[4], g[5]}*)
It is clear that the substitution of i
happed to the function f
inside Table.
So what is the reason that substitution of i
happed in the f
case and does not happened in the Dynamic
case.