Lazier. http://swiftstub.com/596982131 <http://swiftstub.com/596982131>
> On Dec 18, 2015, at 3:32 PM, Erica Sadun <er...@ericasadun.com> wrote: > > p.s. http://swiftstub.com/195460039 <http://swiftstub.com/195460039> > > (I'm sure this could be done more lazily and well) > > >> On Dec 18, 2015, at 2:47 PM, Jacob Bandes-Storch <jtban...@gmail.com >> <mailto:jtban...@gmail.com>> wrote: >> >> Oops, of course I meant product<S1: SequenceType, S2: SequenceType>(...) ! >> >> Jacob >> >> On Fri, Dec 18, 2015 at 1:45 PM, Jacob Bandes-Storch <jtban...@gmail.com >> <mailto:jtban...@gmail.com>> wrote: >> 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 <mailto:swift-users@swift.org>> wrote: >> Source: http://swiftstub.com/788132715 <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 <mailto:swift-users@swift.org> >> https://lists.swift.org/mailman/listinfo/swift-users >> <https://lists.swift.org/mailman/listinfo/swift-users> >> >> >> >
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users