> On Feb 4, 2017, at 14:43, Dave Abrahams via swift-evolution 
> <[email protected]> wrote:
> 
> 
> on Fri Feb 03 2017, Ben Cohen <[email protected]> wrote:
> 
>>> On Feb 3, 2017, at 3:27 PM, Dave Abrahams via swift-evolution
>>> <[email protected]> wrote:
>>> 
>>> I don't always make zip a method, but when I do, its argument label is
>>> “to:”
>> 
>> Hmm, that doesn’t sound very natural to me.
>> 
>> Then again the problem with “zip(with:)" is it’s already kind of a
>> term of art for a version that takes a function to combine the two
>> values.
>> 
>> There’s also the question of how to spell a non-truncating versions
>> (returning optionals or taking a pad value).
> 
> Is there a use-case for such a zip?
> 

Whenever it's not OK to not silently discard the elements in the longer list 
(which can be a correctness trap of zip if you're not careful). Say you're 
matching up contestants from two groups, but want to give byes to the unmatched 
contestants in the larger group. Or you're generating a list of positioned 
racers in a 8-car race, putting in a computer player when you run out of real 
players.

> -- 
> -Dave
> 
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to