Re: Do-command

• To: mathgroup at smc.vnet.net
• Subject: [mg102639] Re: [mg102588] Do-command
• From: "Elton Kurt TeKolste" <tekolste at fastmail.us>
• Date: Mon, 17 Aug 2009 04:06:20 -0400 (EDT)
• References: <200908161038.GAA01118@smc.vnet.net>

```Do does not ask for an output.  Try this

In[24]:= Table[Select[{1, 2, 4, 7, 6, 2}, # >= i &], {i, 7}]

Out[24]= {{1, 2, 4, 7, 6, 2}, {2, 4, 7, 6, 2}, {4, 7, 6}, {4, 7,
6}, {7, 6}, {7, 6}, {7}}

If this is too functional for you, here is a procedural version, in
which the selections are saved in a variable (a) and then displayed

In[27]:= a = Range[7]; Do[
a[[i]] = Select[{1, 2, 4, 7, 6, 2}, # >= i &], {i, 7}]; a

Out[27]= {{1, 2, 4, 7, 6, 2}, {2, 4, 7, 6, 2}, {4, 7, 6}, {4, 7,
6}, {7, 6}, {7, 6}, {7}}

On Sun, 16 Aug 2009 06:38 -0400, "Uwe Gotzes" <u.gotzes at googlemail.com>
wrote:
> Hi!
>
> Can anybody tell, why
> Do[Select[{1, 2, 4, 7, 6, 2}, # >= i &], {i, 7}]
> does not produce output in Mathematica?
>
Regards,
Kurt Tekolste

```

• References:
• Do-command