# Why won't Manipulate work with symbols generated by Symbol?

Suppose I am provided with two data lists. (Assume for the moment that they are lists of integers.) I would like a function that generates bar charts that I can manipulate.

Here is what I have:

f[dL1_List, dL2_List] :=
Module[{dL1SymList, dL2SymList},
dL1SymList = (Symbol["dL1" <> ToString[#]] &) /@ dL1;
dL2SymList = (Symbol["dL2" <> ToString[#]] &) /@ dL2;
(
Manipulate[Grid[{
{
BarChart[dL1SymList, PlotLabel -> "dL1"],
BarChart[dL2SymList, PlotLabel -> "dL2"]
}
}], ##] &
) @@
Join[
MapThread[({{#1, #2}, 0.0, 10*#2} &), {dL1SymList, dL1}],
MapThread[({{#1, #2}, 0.0, 10*#2} &), {dL2SymList, dL2}]
]
];

f[Range[1, 5], Range[1, 5]]


However, while this does not produce any error, it does not display bar graphs either. Can you please help me understand where I am going wrong?

-

Just to get it working: you need to read and fully grok the documentation for Manipulate... it explains in detail why constructs like this are used, and the changes in "expected" behaviors within Manipulate.

f[dL1_List, dL2_List] :=
Module[{dL1SymList, dL2SymList},
dL1SymList = (Symbol["dL1" <> ToString[#]] &) /@ dL1;
dL2SymList = (Symbol["dL2" <> ToString[#]] &) /@ dL2;
(With[{dL1SymList = dL1SymList, dL2SymList = dL2SymList},
Manipulate[
Grid[{{BarChart[dL1SymList, PlotLabel -> "dL1"],
BarChart[dL2SymList, PlotLabel -> "dL2"]}}], ##]] &) @@
Join[MapThread[({{#1, #2}, 0.0, 10*#2} &), {dL1SymList, dL1}],
MapThread[({{#1, #2}, 0.0, 10*#2} &), {dL2SymList, dL2}]]];

f[Range[1, 3], Range[1, 2]]


-
Thank you very much indeed! – Shredderroy Apr 3 '14 at 5:03