<div dir="ltr">Here&#39;s a more from-scratch approach, but I like yours better for obvious reasons.<div><br></div><div><a href="http://swiftstub.com/732424572">http://swiftstub.com/732424572</a><br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div>Jacob Bandes-Storch<br></div></div></div></div>
<br><div class="gmail_quote">On Fri, Dec 18, 2015 at 2:43 PM, Erica Sadun <span dir="ltr">&lt;<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Lazier.<div><br></div><div><a href="http://swiftstub.com/596982131" target="_blank">http://swiftstub.com/596982131</a></div><div><div class="h5"><div><br></div><div><br><div><blockquote type="cite"><div>On Dec 18, 2015, at 3:32 PM, Erica Sadun &lt;<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word">p.s. <a href="http://swiftstub.com/195460039" target="_blank">http://swiftstub.com/195460039</a><div><br></div><div>(I&#39;m sure this could be done more lazily and well)</div><div><br></div><div><br><div><div><blockquote type="cite"><div>On Dec 18, 2015, at 2:47 PM, Jacob Bandes-Storch &lt;<a href="mailto:jtbandes@gmail.com" target="_blank">jtbandes@gmail.com</a>&gt; wrote:</div><br><div><div dir="ltr">Oops, of course I meant product&lt;S1: SequenceType, S2: SequenceType&gt;(...) !<div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div>Jacob<br></div></div></div></div>
<br><div class="gmail_quote">On Fri, Dec 18, 2015 at 1:45 PM, Jacob Bandes-Storch <span dir="ltr">&lt;<a href="mailto:jtbandes@gmail.com" target="_blank">jtbandes@gmail.com</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">1. Maybe ProductGenerator?<div>2. Use AnyGenerator&lt;(T, U)&gt;?</div><div><br></div><div>I&#39;d love to see something like this in stdlib:</div><div><br></div><div>func product&lt;S1, S2&gt;(s1: S1, s2: S2) -&gt; ProductSequence&lt;S1.Generator.Element, S2.Generator.Element&gt; {</div><div>    ...</div><div>}</div><div><br></div><div>where ProductSequence&lt;T,U&gt;.Generator.Element is (T, U).</div><div><br></div><div>So your example could be &quot;for (x,y) in product(0..&lt;4, 0..&lt;2)&quot;.</div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div>Jacob Bandes-Storch<br></div></div></div></div>
<br><div class="gmail_quote"><div><div>On Fri, Dec 18, 2015 at 1:22 PM, Erica Sadun via swift-users <span dir="ltr">&lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div style="word-wrap:break-word">Source: <a href="http://swiftstub.com/788132715" target="_blank">http://swiftstub.com/788132715</a><div><br></div><div>Two questions:</div><div><br></div><div>1. Can anyone recommended a better name than Cartesian? 2D doesn&#39;t work for the compiler and I&#39;m looking for something that doesn&#39;t seem &quot;floating-point&quot;-y</div><div>2. Is there a way to internalize the generator and not make it public? I&#39;d ideally like to hide all details except the fact that this is a sequence of (Int, Int)</div><div><br></div><div>Thanks</div><div><br></div><div>-- Erica</div><div><br></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=P-2BsYbBZHRBuLDBJaL4DIKDNfkkjpROowTyRAObV11qw2GpYjFY1N-2B9BLQyR91bR8qHqJt2Mm45fNMiV5iuydvgsESPIuZoy6xBdV9jAWu1AM518i4JJdezVjoA1zy0lb8zVlfSY1VtgihfsWeYksV3dxjfdw1HLcdZ8Z-2FXBd-2BWlK67Psm9l15JTiAYbGukdRJrQTeDKs8tyS2NW-2BgfERdATY-2FEsttTMbZB0J-2F2iBj9U-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>
<br></div></div>_______________________________________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div></div>
</div></blockquote></div><br></div></div></div></div></blockquote></div><br></div></div></div></div></blockquote></div><br></div></div>