1. Maybe ProductGenerator? 2. Use AnyGenerator<(T, U)>? I'd love to see something like this in stdlib:
func product<S1, S2>(s1: S1, s2: S2) -> ProductSequence<S1.Generator.Element, S2.Generator.Element> { ... } where ProductSequence<T,U>.Generator.Element is (T, U). So your example could be "for (x,y) in product(0..<4, 0..<2)". Jacob Bandes-Storch On Fri, Dec 18, 2015 at 1:22 PM, Erica Sadun via swift-users < swift-users@swift.org> wrote: > Source: http://swiftstub.com/788132715 > > Two questions: > > 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 > 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) > > Thanks > > -- Erica > > > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users > >
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users