The problem is that the global symbols hidden in the definition of ab
are not localized in the Manipulate
. Manipulate
reassigns the a
and b
that appear in the code passed to Manipulate
by Evaluate[Delete[ab, 0]]
to localized DynamicModule
symbols, which are then remapped to front-end dynamic variables whenever the Manipulate
output is instantiated in the front end. (It's a complicated process, which you can read about in the four tutorials on Manipulate
and dynamic functionality, as well as on this site.)
So one easy way to get the sample code to work the way that is asked is to evaluate ab
before it is passed to Manipulate
. The OP's ultimate goal seems unclear, not only to me but to some commenters. It is possible that in a more complicated use-case, the following might not work due to reasons specific to the use-case. However, it works on the present example.
ab := {{a, 10, 100}, {b, 0, 10}}
Manipulate[a*b, Evaluate[Delete[ab, 0]],
Evaluate@With[{ab = ab},
Button["SHow", Print[ab[[1, 1]]];
Print[a, "---", b]]
]
]
Update notice: Originally, I had simply modify the Button
to remove the Symbol
thus: Print[Evaluate[ToString[ab[[1]][[1]]]]
. While that was accepted, on second thoughts, I thought printing the actual value instead a string representation seemed more in line with the wording of the question.
a, b
parameters of a function instead". $\endgroup$a
andb
are scoped and the full name of each is something likeFE`a$$43
. $\endgroup$