[Swift-devel] hanging problem

Mihael Hategan hategan at mcs.anl.gov
Sun Mar 27 20:11:48 CDT 2011


if trying to map some operation from a collection a to a collection b,
one would iterate on the source collection instead of the destination
collection.

Essentially you want to say "for each element in a, let b[i] = f(a[i]))"
instead of "for each element in b, let b[i] = f(a[i]))". In the latter
case, unless you have expressed somehow that b has a certain number of
elements you would get an error or a noop (since b starts with no
elements). However, in swift, that expressing that b has a certain
number of elements is hidden in the semantics of specific mappers and is
therefore not clear or guaranteed.

Mihael

On Sun, 2011-03-27 at 20:02 -0500, Daniel S. Katz wrote:
> Can you suggest how this should be done?
> 
> Dan
> 
> 
> On Mar 27, 2011, at 8:00 PM, Mihael Hategan wrote:
> 
> > Well, you seem to be iterating over an array that you are trying to
> > build inside the iteration, and you are not doing a fold. It's somewhat
> > coincidental that it works, probably because stats is mapped by a static
> > mapper and you don't actually use the value ("img").
> > 
> > Though I see what you are trying to do. And it should either work or
> > fail nicely. So I'll see if I can make a simple test case out of this.
> > 
> > Mihael
> > 
> > On Sun, 2011-03-27 at 19:43 -0500, Jonathan Monette wrote:
> >> stats is an array mapped to several files in a directory of metadata
> >> generated by mFitplane.  I need to pass all these files and another
> >> metadata file to mConcatFit which is the app after this foreach loop.
> >> I need to wait for the foreach loop to be complete before mConcatFit
> >> can run.
> >> 
> >> On Sun, Mar 27, 2011 at 7:41 PM, Mihael Hategan <hategan at mcs.anl.gov>
> >> wrote:
> >>        You have:
> >>        foreach img, i in stats
> >>           {
> >>               stats[ i ] = mFitplane ( diff_imgs[i] );
> >>           }
> >> 
> >> 
> >>        What is it that you are trying to do there?
> >> 
> >>        Mihael
> >> 
> >> 
> >>        On Sun, 2011-03-27 at 15:54 -0500, Jonathan Monette wrote:
> >>> here is my entire script
> >>> 
> >>> On Sun, Mar 27, 2011 at 3:45 PM, Mihael Hategan
> >>        <hategan at mcs.anl.gov>
> >>> wrote:
> >>>        On Wed, 2011-03-23 at 16:31 -0500, Jonathan Monette
> >>        wrote:
> >>> 
> >>>> How can the array be closed but all of its values
> >>        not be?
> >>> 
> >>> 
> >>>        The array being closed simply means that its size is
> >>        known,
> >>>        but not
> >>>        necessarily that its elements have all been
> >>        computed.
> >>> 
> >>>        I'll look at the log, but I'd also like the entire
> >>        script.
> >>> 
> >>>        Mihael
> >>> 
> >>> 
> >>> 
> >>> 
> >>> 
> >>> --
> >>> Any intelligent fool can make things bigger and more
> >>        complex... It
> >>> takes a touch of genius - and a lot of courage to move in
> >>        the opposite
> >>> direction.
> >>> - Albert Einstein
> >>> 
> >>> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> -- 
> >> Any intelligent fool can make things bigger and more complex... It
> >> takes a touch of genius - and a lot of courage to move in the opposite
> >> direction.
> >> - Albert Einstein
> >> 
> >> 
> > 
> > 
> > _______________________________________________
> > Swift-devel mailing list
> > Swift-devel at ci.uchicago.edu
> > http://mail.ci.uchicago.edu/mailman/listinfo/swift-devel
> 





More information about the Swift-devel mailing list