<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi --<div><br></div><div>I have a simple problem to which I would like to find a simple and elegant solution.</div><div><br></div><div>I will use this example:</div><div><br></div><div>int matsize[] = [5, 20, 30, 50, 100, 75, 45, 15];</div><div><div><br></div><div>file MagicSquares[] <simple_mapper; prefix="magicmat.",suffix=".dat">;</div><div><br></div><div>foreach s, i in matsize {</div><div> MagicSquares[i] = magicsq (MCRPath, s);</div><div>}</div></div><div><br></div><div>This work fine, but let us suppose that instead I need to loop over two sets of variables:</div><div><br></div><div><div>int matmax[] = [5, 20, 30, 50, 100, 75, 45, 15];</div><div><div><br></div><div>for each max, indexmax matmax {</div><div><br></div><div> file MagicSquares[] <simple_mapper; prefix=@strcat("magicmat.",max,"."),suffix=".dat">;</div><div><b> matsize = "["`seq -s"," max`"]";</b></div><div><br></div><div> foreach s, i in matsize {</div><div> MagicSquares[i] = magicsq (MCRPath, s);</div><div> }</div></div></div><div><br></div><div>}</div><div><br></div><div>Of course the operation I put in bold is not going to compile and would produce a "string"(?). </div><div>I can think of ways of doing it, but I realized that all methods would return an array that I am not sure is perceived as such by swift.</div><div><br></div><div>A multidimensional arrays would probably do the trick too.</div><div><br></div><div>What would be the "best" way of doing this?</div><div><br></div></body></html>