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

Jacob Bandes-Storch jtbandes at gmail.com
Fri Dec 18 15:47:12 CST 2015


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>
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> 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 at swift.org
>> 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/ca1b172d/attachment.html>


More information about the swift-users mailing list