Re: making a list using table but with different increment after a certain number

• To: mathgroup at smc.vnet.net
• Subject: [mg81498] Re: making a list using table but with different increment after a certain number
• Date: Wed, 26 Sep 2007 06:36:11 -0400 (EDT)
• References: <fd7sae\$cgl\$1@smc.vnet.net>

```On Sep 24, 3:25 am, sean_incali <sean_inc... at yahoo.com> wrote:
> I can make a list using
>
> Table[a, {a, 0, 100, 10}]
>
> gives
>
> {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}
>
> But let's say I wanted to make a list that increment in 1 up to 10,
> then increment in 10 onwards.
>
> So that after "tabling" I would get...
>
> {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90,
> 100}
>
> How do I accomplish this?

One solution is to map the Table function onto a list of iterators and
Join the resulting lists, like this:

In[7]:= Join @@ (Table[i, #] & /@ {{i, 1, 9}, {i, 10, 100, 10}})

Out[7]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80,
90, 100}

I'm not sure how familiar you are with Mathematica, so forgive me if

In the above command, 'Table[i, #] &' is a pure function, similar to
the anonymous functions or lambda functions that many other
programming languages provide.  The '/@' operator (shorthand for
'Map') applies that function to every element in the following list,
and places the results into a new list.  'Join' joins the elements of
this new list into a single list.

Hope that helps!