comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Cc: nma@12000.org
Subject: Re: questions on using the array component iterator for 2012
Date: Wed, 27 Jun 2012 16:31:33 -0700 (PDT)
Date: 2012-06-27T16:31:33-07:00	[thread overview]
Message-ID: <ac03aab4-11cd-4904-a5dc-d09aa96cb9e6@googlegroups.com> (raw)
In-Reply-To: <js4b8m$21r$1@speranza.aioe.org>

On Saturday, June 23, 2012 7:02:18 AM UTC-5, Nasser M. Abbasi wrote:
> For example, assume I write
>     FOR e of A  LOOP
>         e := e + 1 ;
>     END LOOP
> [...]
> 
> But suppose I want to implement say a Jacobi relaxation
> iteration to solve a 2D Laplace pde on that grid, which
> is defined to update each element in the grid using
> 
> A(i,j) := (1/4) (  A(i-1,j)+A(i+1,j)+A(i,j-1)+A(i,j+1)
> 
> where here 'i' is row index, and 'j' is column index.

Well the problem is that the "FOR E IN ..." loop is conceptually different from a "FOR Index IN Array_Variable'RANGE" loop. The difference is that in the former you don't care what the index/indices are, you just want to apply the same procedure to each element.

Given that needing the index is sometimes wanted, the designers may have added a 'Index(X) attribute, I don't really know because I've not had the inclination to explore the new loop in such depth.



      parent reply	other threads:[~2012-06-27 23:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-23 12:02 questions on using the array component iterator for 2012 Nasser M. Abbasi
2012-06-23 12:04 ` Nasser M. Abbasi
2012-06-25 18:19 ` Adam Beneschan
2012-06-25 18:53   ` Nasser M. Abbasi
2012-06-27 23:31 ` Shark8 [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox