<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Having discussed it with the team, I withdraw my objection to the implementation strategy. &nbsp;CollectionOfZeroOrOne is an orthogonal capability that should be handled separately, if at all.<div class=""><br class=""></div><div class="">So, +1 for acceptance, provided there are tests.<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 16, 2015, at 12:14 PM, Dave Abrahams via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">OK, maybe I need to think about this more carefully. &nbsp;Sorry if I drew incorrect/hasty conclusions.<div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 16, 2015, at 11:35 AM, Donnacha Oisín Kidney &lt;<a href="mailto:oisin.kidney@gmail.com" class="">oisin.kidney@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Oops, sorry, I wasn’t very clear. I was just trying to compare the amount of code reuse and new types between the two versions.&nbsp;<span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">CollectionOfZeroOrOne</span>&nbsp;would need three extensions (<span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">SequenceType</span>,&nbsp;<span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">CollectionType</span>&nbsp;&nbsp;<span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">BidirectionalIndexType</span>&nbsp; as well as the extra struct itself. The filter version doesn’t <i class="">really</i>&nbsp;need a new struct, but to have a bidirectional version, you would need a&nbsp;<span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">LazyFilterBidirectionalCollection</span>&nbsp; which doesn’t currently exist. I had thought that that was something which may be added anyway, though.<br class=""><div class=""><br class=""></div><div class="">Oisin.</div><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 16 Dec 2015, at 19:08, Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com" class="">dabrahams@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 16, 2015, at 10:15 AM, Dmitri Gribenko &lt;<a href="mailto:gribozavr@gmail.com" class="">gribozavr@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Wed, Dec 16, 2015 at 7:10 AM, Donnacha Oisín Kidney <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Now that I think about it, of course&nbsp;<span style="color:rgb(112,61,170);font-family:Menlo;font-size:11px" class="">CollectionOfZeroOrOne</span>&nbsp;would (or&nbsp;<span style="color:rgb(112,61,170);font-family:Menlo;font-size:11px" class="">Optional</span>) have a random access index. I’ll update the proposal to include that.<br class=""><div class=""><br class=""></div><div class="">I really like the&nbsp;<span style="color:rgb(112,61,170);font-family:Menlo;font-size:11px" class="">CollectionOfZeroOrOne</span>&nbsp;solution. The semantics and types certainly make more sense. I’m not sure that it reduces the amount of code, though: the three extensions are still needed, plus an extra struct. (I suppose that’s not counting the extra version of&nbsp;<span style="color:rgb(112,61,170);font-family:Menlo;font-size:11px" class="">LazyFilterCollection</span>. Am I right in saying that that is intended to be added?)</div></div></blockquote></div></div></div></div></blockquote><div class=""><br class=""></div>I'm not sure I understand why we need another version of LazyFilterCollection. &nbsp;Can you explain?</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">Here’s what I have for the collection (I tried to mimic the standard library’s&nbsp;<span style="color:rgb(112,61,170);font-family:Menlo;font-size:11px" class="">CollectionOfOne</span>):</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:#bb2ca2" class="">public</span> <span style="color:#bb2ca2" class="">struct</span> CollectionOfZeroOrOne&lt;Element&gt; : <span style="color:#703daa" class="">CollectionType</span> {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><font class="">[...]</font></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class="">}</div></div><div class=""><br class=""></div><div class="">Does that seem reasonable?</div></div></blockquote><div class=""><br class=""></div><div class="">It looks reasonable, but I don't understand why adding CollectionOfZeroOrOne improves the API.&nbsp; Dave?</div></div></div></div></div></blockquote><div class=""><br class=""></div>It doesn't. &nbsp;I think it improves code reuse, and gives people an adapter to use when they want to pass an Optional where a Collection or Sequence is required.</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">Dmitri</div><div class="">&nbsp;</div></div>-- <br class=""><div class="gmail_signature">main(i,j){for(i=2;;i++){for(j=2;j&lt;i;j++){if(!(i%j)){j=0;break;}}if<br class="">(j){printf("%d\n",i);}}} /*Dmitri Gribenko &lt;<a href="mailto:gribozavr@gmail.com" target="_blank" class="">gribozavr@gmail.com</a>&gt;*/</div>
</div></div>
</div></blockquote></div><br class=""><div class="">
-Dave<div class=""><br class=""></div><br class="Apple-interchange-newline">

</div>
<br class=""></div></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""><div class="">
-Dave<div class=""><br class=""></div><br class="Apple-interchange-newline">

</div>
<br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=JfMPa-2F7wwZPzsZ3QKA8NjtONIYX4SjbWuUxtpfsTY2h0JWYk-2FBvLPeSV4WXcRn6vI6gCFL6CqX58Xcfis4undYY25wctTn1jXiJBpvitKIyj7m41Df7L7kZwx3NDZnk5KvEfXcUuAkH8pcArECDBVclCXhSnLVuyzqS9-2B37Zzef8XBmbWzgbrERM4b0kKfjjE-2FBUH6-2F8a6Q-2Fy-2BDvlC67BVWPW122J08mzVw2vGLu8MM-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""><div class="">
-Dave<div class=""><br class=""></div><br class="Apple-interchange-newline">

</div>
<br class=""></div></div></body></html>