[Swift-devel] file declaration inside foreach

Ben Clifford benc at hawaga.org.uk
Tue Apr 24 15:44:59 CDT 2007



On Tue, 24 Apr 2007, Veronika  V. Nefedova wrote:

> The main problem: it submitted 2 jobs at once (foreach loop is for i=1,2). And
> since the jobs were supposed to run one after another - they all failed
> (application failure)

ok. That's expected, or at least, I expect it.

foreach is a parallel map-like operation for running some action on each 
element in an array independent of the other elements.

I think you probably can't express that kind of iteration in SwiftScript 
at the moment (unless 'while' happens to work for you) though I'm poking 
round with ways to express that. (in functional programming terms, you're 
trying to do a fold rather than a map, I think).

-- 



More information about the Swift-devel mailing list