MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Getting rid of those deprecated Doloops?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92782] Re: Getting rid of those deprecated Doloops?
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Mon, 13 Oct 2008 06:18:34 -0400 (EDT)

On 10/12/08 at 4:35 AM, siegman at stanford.edu (AES) wrote:

>Trying to think of a "two-variable iterator" approach that will let
>one produce the same results as

>data = { }; Do[
>Do[ data = AppendTo[data, {aa, bb, xx, yy}], {bb, 10, 30, 10}], {aa,
>1, 2}];  Print[data // TableForm];

>without using those universally deprecated (and even worse, nested)
>Do[ ] loops, not to mention the equally deprecated AppendTo[].

The following gives the same result:

In[1]:= {Ceiling[#/3], 10 Mod[#, 3, 1], xx, yy} & /@ Range[6]

Out[1]= {{1, 10, xx, yy}, {1, 20, xx, yy}, {1, 30, xx, yy},
    {2, 10, xx, yy}, {2, 20, xx, yy}, {2, 30, xx, yy}}


  • Prev by Date: Conditional SetDelayed with Replacement
  • Next by Date: Re: Turning off default rules associated with TableHeadings?
  • Previous by thread: Re: Conditional SetDelayed with Replacement
  • Next by thread: Re: Resize dynamic graphics - How?