<div dir="ltr">Here'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"><<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>></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 <<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>> 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'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 <<a href="mailto:jtbandes@gmail.com" target="_blank">jtbandes@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Oops, of course I meant product<S1: SequenceType, S2: SequenceType>(...) !<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"><<a href="mailto:jtbandes@gmail.com" target="_blank">jtbandes@gmail.com</a>></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<(T, U)>?</div><div><br></div><div>I'd love to see something like this in stdlib:</div><div><br></div><div>func product<S1, S2>(s1: S1, s2: S2) -> ProductSequence<S1.Generator.Element, S2.Generator.Element> {</div><div> ...</div><div>}</div><div><br></div><div>where ProductSequence<T,U>.Generator.Element is (T, U).</div><div><br></div><div>So your example could be "for (x,y) in product(0..<4, 0..<2)".</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"><<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>></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't work for the compiler and I'm looking for something that doesn't seem "floating-point"-y</div><div>2. Is there a way to internalize the generator and not make it public? I'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>