[swift-users] Need better name, want to hide generator

Erica Sadun erica at ericasadun.com
Fri Dec 18 16:43:23 CST 2015


Lazier.

http://swiftstub.com/596982131 <http://swiftstub.com/596982131>


> On Dec 18, 2015, at 3:32 PM, Erica Sadun <erica at 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 <jtbandes at gmail.com <mailto:jtbandes at 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 <jtbandes at gmail.com <mailto:jtbandes at 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 at swift.org <mailto:swift-users at 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 at swift.org <mailto:swift-users at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-users <https://lists.swift.org/mailman/listinfo/swift-users>
>> 
>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151218/d4871109/attachment.html>


More information about the swift-users mailing list