<div dir="ltr"><div>Ok, I see, thanks, that makes a lot of sense.<br><br>So essentially each append() call creates a new opaque key value that is guaranteed to be unique and the same across runs, then the rest follows from that.<br>
<br></div>- Tim<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 4, 2013 at 4:07 PM, Mihael Hategan <span dir="ltr"><<a href="mailto:hategan@mcs.anl.gov" target="_blank">hategan@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Wed, 2013-09-04 at 15:23 -0500, Tim Armstrong wrote:<br>
> Awesome, thanks, that clears things up.  For some reason I was thinking<br>
> that [auto] was something like an auto-incremented integer.<br>
<br>
</div>I think we quickly dismissed that because of the problems you alluded to<br>
in the previous email.<br>
<br>
There is also the issue of re-starts, which requires that the index<br>
allocation be deterministic (actually identical) between different runs<br>
of the same script.<br>
<div class="im"><br>
><br>
> Does that mean that "b[k] = x"  and append(b, x) are semantically identical<br>
> in these two code fragments?<br>
><br>
> ==============<br>
> foreach v, k in a {<br>
>    b[k] = a[k] * 2;<br>
> }<br>
> ---------------------------<br>
> foreach v in a {<br>
>    append(b, a[k] * 2);<br>
> }<br>
> ==============<br>
<br>
</div>Nope. The first guarantees that both arrays have the same number of<br>
elements AND the same keys.<br>
<br>
The second one only guarantees that the arrays have the same number of<br>
elements.<br>
<br>
The distinction is obvious if you add another loop:<br>
<div class="im"><br>
foreach v, k in a {<br>
</div>   int s = a[k] + b[k];<br>
}<br>
<br>
That subsequent foreach is only guaranteed to work in the first case you<br>
have above.<br>
<div class="im"><br>
><br>
> Also, I was wondering how this interacts with mappers?  E.g. if a have an<br>
> [auto] array mapped with simple_mapper, then what filenames would be<br>
> produced for something like this?<br>
> file outfile[] <simple_mapper;prefix="baz",suffix=".txt">;<br>
><br>
> append(outfile , ...);<br>
><br>
> append(outfile , ...);<br>
<br>
</div>Like a [int] array. The string keys get SHA-1ed.<br>
<br>
Which might be  a reasonable solution to getting rid of the string keys.<br>
Thanks!<br>
<span class="HOEnZb"><font color="#888888"><br>
Mihael<br>
<br>
</font></span></blockquote></div><br></div>