I would like to be able to call a function an unspecified number of times. That is, I would like the generalization of something like:
Sample[yi_, yf_, yinc_, zi_, zf_, zinc_]:=
Table[{y, z}, {y, yi, yf, yinc}, {z, zi, zf, zinc}]
to $n$ variables, all with their own respective initial, finial and incremental values, and so I'd be calling on Table $n$ times. Is something like this even possible?
ranges__and avoidSequenceandEvaluate. – Szabolcs Mar 22 '12 at 14:20ranges:{{_Symbol, _?NumericQ, _?NumericQ, _?NumericQ} ..}orranges:{_Symbol, _?NumericQ, _?NumericQ, _?NumericQ} ..which forces the user to give the correct form for the iterators. Personally, I'd use the second form ofrangesas it is called likeTable:sample[{x,0,3,1},{y,-2,2,1}]. Also, you'd remove theSequence @@shortening the code. – rcollyer Mar 22 '12 at 14:25{x, 0, 3, 1}, {y, 0, x, 1}. – whuber Mar 22 '12 at 15:00?NumericQfrom them which will allow the additional constructs. – rcollyer Mar 22 '12 at 15:17_Symbolpattern for the initial argument: this solution is unlikely to work without enforcing that requirement, at least. – whuber Mar 22 '12 at 15:20(_Symbol | _?NumericQ),so that both numeric and symbolic arguments are allowed. Personally, I find this construct amusing:sample[range : With[{x = (_Symbol | _?NumericQ)}, {_Symbol, x, x, _?NumericQ}] ..]. – rcollyer Mar 23 '12 at 03:19