<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">Function zip constructs a sequence of pairs out of two sequences (Zip2Sequence). This sequence contains `min(sequence1.count, sequence2.count)` elements. I suggest to add sequence that contains `max(sequence1.count, sequence2.count)` elements (Zip2SequenceWithNilPadding). </div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">For example: </div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">let n = [2, 3, 5, 7, 11]</div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">let s = ["two", "three", "five", "seven", "eleven", "thirteen"]</div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">let regularZip = zip(n, s)</div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">// regularZip: 2 => two, 3 => three, 5 => five, 7 => seven, 11 => eleven (5 items)</div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">let proposedZip = zipWithNilPadding(n, s)</div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">// proposedZip: 2 => two, 3 => three, 5 => five, 7 => seven, 11 => eleven, nil => thirteen (6 items)</div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">I personally use zip to manage two sequences as one. Sometimes I do need to manage leftovers from longer sequence. In such case regular zip is not helpful.</div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">About types. In oppose to Zip2Sequence that contains pairs of elements from each sequence (Sequence1.Generator.Element, Sequence2.Generator.Element), Zip2SequenceWithNilPadding will have to contain pairs of optional elements from each sequence (Sequence1.Generator.Element?, Sequence2.Generator.Element?).</div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class=""><br class=""></div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">Original idea from here: <a href="http://stackoverflow.com/questions/25153477/in-swift-i-would-like-to-join-two-sequences-in-to-a-sequence-of-tuples" class="">http://stackoverflow.com/questions/25153477/in-swift-i-would-like-to-join-two-sequences-in-to-a-sequence-of-tuples</a></div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class=""><br class=""></div><div class="">Thanks,</div><div class="">Anton Mironov</div><div class=""><br class=""></div></body></html>