Re: Cascaded (Multi-range) Iterators?
- To: mathgroup at smc.vnet.net
- Subject: [mg79081] Re: Cascaded (Multi-range) Iterators?
- From: AES <siegman at stanford.edu>
- Date: Wed, 18 Jul 2007 02:54:16 -0400 (EDT)
- Organization: Stanford University
- References: <f7f2lh$o64$1@smc.vnet.net> <f7hr0h$qi2$1@smc.vnet.net>
Again thanks for multiple replies. I think the suggestion from David
Park
> Table[f[x], {x, Join[Range[0, 1, 0.1], Range[2, 10], Range[20, 100, 10]]}]
is by quite a ways the best (i.e., simplest, most understandable,
easiest to remember) of the bunch.
Other solutions like
> Flatten[Table[f[x], #] & /@ {{x, 0, 1, 0.1}, {x, 2, 10}, {x, 20, 100,
10}}, 1]
seem to me to be much more arcane, APL-like rather than
Mathematica-like, involving cascaded #, & and /@ symbols, and Flatten
seemingly applied to the Table, not the Iterator. It's not neat or
easily readable; in fact, it's ugly.
In any case, I'd still claim that:
> A very useful, rememberable (and feasible?)
> extension to the Iterator concept for Tables, etc., would be a
> cascaded or multi-range Iterator syntax, e.g. something like
>
> Table[ f[x], { {x, 0, 1, 0.1}, {x, 2, 10}, {x, 20, 100, 10} } ]