The code
Table[i, {i, 5}]
produces the output
{1, 2, 3, 4, 5}
whereas the code
x = {i, 5};
Table[i, x];
produces an error, namely
Table::itform: Argument x at position 2 does not have the correct form for an iterator.
Why, and how do I fix this?
Table@@{i,x}. If you check theAttributesofTableyou will notice that has theHoldAllattribute so thexwill not be evaluated. – Spawn1701D Apr 22 '13 at 01:56Table[i,x//Evaluate]but I find it a little ugly :P – Spawn1701D Apr 22 '13 at 01:57With[{x = {i, 5}}, Table[i, x]]. – chyanog Apr 22 '13 at 09:47This question is REALLY about how you pass an entire iterator form as a value to a function.
The other question is about getting a built in function to correctly handle a new, user-specified iterator form.
They are just superficially similar in that they both (incidentally) use the iterator argument to
– billc Aug 20 '15 at 05:13Tableas an example problem for the actual underlying question.