[Swift-devel] file declaration inside foreach
Mihael Hategan
hategan at mcs.anl.gov
Mon Apr 30 15:06:40 CDT 2007
On Mon, 2007-04-30 at 20:02 +0000, Ben Clifford wrote:
>
> On Wed, 25 Apr 2007, Mihael Hategan wrote:
>
> > On Wed, 2007-04-25 at 10:04 -0500, Mihael Hategan wrote:
> > > That with the assumption that k[i-1] would work.
> > > It seems that k[i] = k[i-1] + i gets translated into this:
> > > assign(dpath="[i]", dvar=k,
> > > svar = sum(getFieldValue(var=k, path=concat("[]")), getFieldValue(i))
> > > )
> > >
> > > Seems like k[i-1] is translated into the wrong thing there
> > > (path=concat("[]")).
> >
> > It could, instead, be translated into: concat("[", subtraction(i, 1),
> > "]"). My guess is that would work.
>
> I tried this:
>
> <vdl:assign dpath="[i]" dvar="{k}">
> <argument name="svar">
> <sum>
> <vdl:getfieldvalue var="{k}">
> <argument name="path">
> <concat>
> <string>[</string>
> <subtraction><variable>i</variable>
> <number>1</number>
> </subtraction>
> <string>]</string>
> </concat>
> </argument>
> </vdl:getfieldvalue>
> <vdl:getfieldvalue var="{i}"/>
> </sum>
> </argument>
> </vdl:assign>
>
> which I think is pretty much what you said in the non-xml syntax.
>
> But I get this:
>
> $ swift aaaa.kml
> Swift V 0.0405
> RunID: 7e7ozhoot4ha0
> Execution failed:
> org.globus.cog.karajan.workflow.KarajanRuntimeException: Could not
> convert value to number: 1
That's 'i' being a vdl var.
>
> so then I tried this instead:
>
> <parallelFor name="$">
> <vdl:getarrayfieldvalue path="" var="{r}"/>
> <set names="$$, i">
> <each items="{$}"/>
> </set>
> <vdl:assign dpath="[i]" dvar="{k}">
> <argument name="svar">
> <sum>
> <vdl:getfieldvalue var="{k}">
> <argument name="path">
> <concat>
> <string>[</string>
>
> <subtraction><getfieldvalue><variable>i</variabl
> e></getfieldvalue>
> <number>1</number>
> </subtraction>
> <string>]</string>
> </concat>
> </argument>
> </vdl:getfieldvalue>
> <vdl:getfieldvalue var="{i}"/>
> </sum>
> </argument>
> </vdl:assign>
> </parallelFor>
>
>
> (adding in a getfieldvalue)
>
> and when I run that it sits in an infinite loop (second today lucky me!)
Because of unrelated reasons I suppose.
>
> Bleugh.
>
> full kml (edited from what came out of the compiler) is
> http://www.ci.uchicago.edu/~benc/aaaa.kml
>
> and the source I started with is in
>
> http://www.ci.uchicago.edu/~benc/aaaa.swift
>
More information about the Swift-devel
mailing list