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

Jacob Bandes-Storch jtbandes at gmail.com
Fri Dec 18 17:05:48 CST 2015


Here's a more from-scratch approach, but I like yours better for obvious
reasons.

http://swiftstub.com/732424572

Jacob Bandes-Storch

On Fri, Dec 18, 2015 at 2:43 PM, Erica Sadun <erica at ericasadun.com> wrote:

> Lazier.
>
> 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
>
> (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>
> 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>
> 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/597ae1f7/attachment.html>


More information about the swift-users mailing list