[Swift-user] Re: Swift app question

Mihael Hategan hategan at mcs.anl.gov
Wed Sep 8 21:21:32 CDT 2010


What the code says there is iterate through some list holding the
current iteration variable in "y" and then declare an entirely new
variable, also named "y", in the inner scope of the iteration an assign
it the value of some computation. Is this what you meant?

In other words variables in swift are single assignment. You can't
successively assign different values to the same variable in the same
scope.

On Thu, 2010-09-09 at 00:52 +0000, jon.monette at gmail.com wrote:
> Yes. This is the general work flow to part of my problem
> ------Original Message------
> From: Mihael Hategan
> To: Jonathan Monette
> Cc: swift-user at ci.uchicago.edu
> Cc: Justin M Wozniak
> Subject: Re: Swift app question
> Sent: Sep 8, 2010 7:51 PM
> 
> On Wed, 2010-09-08 at 18:45 -0500, Jonathan Monette wrote:
> > Hello,
> >      This is probably a simple question but when are app functions 
> > executed?  Take a look at this psuedocode.
> > 
> > 
> > foreach y in years
> > {
> >          Month m1< "month1.txt">;
> >          Month m2 <"month2.txt">;
> > 
> >          Year y = calculate( m1, m2 );
> > }
> > 
> > When will the app "calculate" be executed?  Will it execute as soon as 
> > m1 and m2 for a given iteration are mapped or will it wait till each 
> > thread has mapped its own m1 and m2 and execute the apps all together.
> 
> Is the use of y twice (once in the foreach and once for the result of
> calculate()) accidental?
> 
> Mihael
> 
> 
> 
> Sent on the Sprint® Now Network from my BlackBerry®





More information about the Swift-user mailing list