<div dir="ltr">I think this use-case is too narrow for dedicated syntax in the standard library.<div><br></div><div>However, it should be simple enough for you to write your own function, let’s call it `unpack`, which produces a sequence that does what you want.</div><div><br></div><div>While you’re at it you could also try writing a `cross` function that takes two collections and produces all tuples of their elements, perhaps using something like .lazy.map.zip internally, if you need that functionality.<div><div><br></div><div>One great aspect of Swift is that it makes implementing things like this yourself readily achievable. Plus, once we get constrained extensions (extension Collection where Element: Collection) you should be able to do it that way too.</div><div><br></div><div>Alternatively, you might consider whether your data structure itself is ideal or if you’d be better off flattening everything into, say, a single dictionary that takes a compound key.</div><div><br></div><div>Nevin</div><div><br></div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 17, 2016 at 6:05 AM, Maxim Bogdanov via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello, community.<br><br>As I understood from documentation the only way to iterate multidimensional array or a dictionary (with for loop) is this:<br><br><div>let multidimensionalDictionary = [&quot;a&quot;:[&quot;b&quot;: &quot;c&quot;], &quot;b&quot;:[&quot;c&quot;: &quot;d&quot;], &quot;c&quot;: [&quot;d&quot;: &quot;e&quot;]]</div><div>for (key, value) in multidimensionalDictionary {<br></div><div>    for (nestedKey, nestedValue) in value {</div><div>        print(&quot;\(key) -&gt; \(nestedKey) -&gt; \(nestedValue)&quot;)</div><div>    }</div><div>}</div><div><br></div><div>What do you think about this syntax?<br><div>for (key, nestedKey, nestedValue) in multidimensionalDictionary {</div><div>    print(&quot;\(key) -&gt; \(nestedKey) -&gt; \(nestedValue)&quot;)</div><div>}<br><br><br>--<br>I&#39;m new to mailing list feature. If I do something wrong please let me know about it.<br><br>Best regards,<br>Maxim</div></div></div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>