<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">[Issue] Collection.distance() works not very well in some situations</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">The question is that, whether the original Collection&nbsp;Protocol requires index from lower to higher (startIndex &lt; endIndex).</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">If the original Collection&nbsp;Protocol requires index from lower to higher, than this&nbsp;infinity loop should not happen:</span></font></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: rgb(186, 45, 162);" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""></div><blockquote type="cite" class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: rgb(186, 45, 162);" class="">class</span>&nbsp;MyCollectionA :&nbsp;<span style="color: rgb(112, 61, 170);" class="">Collection</span>&nbsp;{</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">var</span>&nbsp;startIndex:&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>&nbsp;{</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">return</span><font color="#272ad8" class="">&nbsp;1</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">var</span>&nbsp;endIndex:&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>&nbsp;{</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">return</span>&nbsp;<font color="#272ad8" class="">100</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">func</span>&nbsp;index(after i:&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>) -&gt;&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>&nbsp;{</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">return</span>&nbsp;i +&nbsp;<span style="color: rgb(39, 42, 216);" class="">2</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 13px;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(0, 132, 0);" class="">&nbsp; &nbsp;&nbsp;</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">subscript</span>(position:&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>) -&gt;<font color="#703daa" class="">&nbsp;Void</font>&nbsp;{</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">return ()</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;}</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(79, 129, 135);" class=""><span style="color: #ba2da2" class="">let</span><span style="color: #000000" class="">&nbsp;a = </span>MyCollectionA<span style="color: #000000" class="">()</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font color="#4f8187" class="">a</font>.<span style="color: #3e1e81" class="">distance</span>(from: <span style="color: #272ad8" class="">0</span>, to: <span style="color: #272ad8" class="">100</span>) // 50</div></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font color="#4f8187" class="">a</font>.<span style="color: rgb(62, 30, 129);" class="">distance</span>(from:&nbsp;<font color="#272ad8" class="">1</font>, to:&nbsp;<span style="color: rgb(39, 42, 216);" class="">100</span>) // !! Infinity Loop</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">a.count // !! Infinity Loop</div></div></blockquote><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><div style="font-family: Menlo; font-size: 11px; margin: 0px; font-stretch: normal; line-height: normal;" class=""><br class=""></div><div style="font-family: Menlo; font-size: 11px; margin: 0px; font-stretch: normal; line-height: normal;" class="">if we assume the index is from lower to higher, the implementation of the distance(from:to:) should use "&lt;" with "while" to count distance</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; font-stretch: normal; line-height: normal;" class=""><br style="color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 14px;" class=""><blockquote type="cite" style="font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 14px;" class=""></blockquote><blockquote type="cite" class=""><table class="tab-size js-file-line-container highlight" data-tab-size="8" style="box-sizing: border-box; border-spacing: 0px; border-collapse: collapse; tab-size: 8; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 14px;"><tbody style="box-sizing: border-box;" class=""><tr style="box-sizing: border-box;" class=""><td id="LC980" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;"><table class="tab-size js-file-line-container highlight" data-tab-size="8" style="box-sizing: border-box; border-spacing: 0px; border-collapse: collapse; tab-size: 8; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 14px;"><tbody style="box-sizing: border-box;" class=""><tr style="box-sizing: border-box;" class=""><td id="LC985" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;"><br class=""></td></tr><tr style="box-sizing: border-box;" class=""><td id="L986" class="blob-num js-line-number" data-line-number="986" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.298039); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none;"><br class=""></td><td id="LC986" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">var</span> start<font color="#d73a49" class=""> = start</font><span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">
</span><span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">    var</span> count<span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">IndexDistance</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">0</span>
</td></tr><tr style="box-sizing: border-box;" class=""><td id="L987" class="blob-num js-line-number" data-line-number="987" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.298039); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none;"></td><td id="LC987" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">while</span> start <font color="#d73a49" class="">&lt;</font> end { // instead of using !=</td></tr><tr style="box-sizing: border-box;" class=""><td id="L988" class="blob-num js-line-number" data-line-number="988" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.298039); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none;"></td><td id="LC988" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">      count <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">=</span> count <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">+</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">1</span></td></tr><tr style="box-sizing: border-box;" class=""><td id="L989" class="blob-num js-line-number" data-line-number="989" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.298039); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none;"></td><td id="LC989" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">      <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">formIndex</span>(<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">after</span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">&amp;</span>start)</td></tr><tr style="box-sizing: border-box;" class=""><td id="L990" class="blob-num js-line-number" data-line-number="990" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.298039); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none;"></td><td id="LC990" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    }</td></tr><tr style="box-sizing: border-box;" class=""><td id="L991" class="blob-num js-line-number" data-line-number="991" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.298039); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none;"></td><td id="LC991" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">return</span> count</td></tr><tr style="box-sizing: border-box;" class=""><td id="L992" class="blob-num js-line-number" data-line-number="992" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.298039); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none;"></td><td id="LC992" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">  }</td></tr></tbody></table></td></tr></tbody></table></blockquote><table class="tab-size js-file-line-container highlight" data-tab-size="8" style="box-sizing: border-box; border-spacing: 0px; border-collapse: collapse; tab-size: 8; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 14px;"><tbody style="box-sizing: border-box;" class=""><tr style="box-sizing: border-box;" class=""><td id="LC980" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;"><div class=""><br class=""></div></td></tr><tr style="box-sizing: border-box;" class=""><td id="L985" class="blob-num js-line-number" data-line-number="985" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.298039); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none;"></td><td id="LC985" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;"><br class=""></td></tr></tbody></table></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><div style="font-family: Menlo; font-size: 11px;" class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Menlo" style="font-family: Helvetica; font-size: 12px;" class=""><span style="font-size: 11px;" class="">If the original Collection&nbsp;Protocol not requires index from to higher, than the code below should works, but&nbsp;</span></font><font face="Menlo" class=""><span style="font-size: 11px;" class="">unfortunately, the code in Collection.distance does not allow.</span></font></div></div><div style="font-family: Menlo; font-size: 11px;" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font></div><div style="font-family: Menlo; font-size: 11px;" class=""><br class=""></div></div></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""></div><blockquote type="cite" class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">class</span> MyCollectionB : <span style="color: #703daa" class="">Collection</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">var</span> startIndex: <span style="color: #703daa" class="">Int</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ba2da2" class="">return</span> <span style="color: #272ad8" class="">100</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">var</span> endIndex: <span style="color: #703daa" class="">Int</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ba2da2" class="">return</span> <span style="color: #272ad8" class="">0</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">func</span> index(after i: <span style="color: #703daa" class="">Int</span>) -&gt; <span style="color: #703daa" class="">Int</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ba2da2" class="">return</span> i - <span style="color: #272ad8" class="">2</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; </span>// start, end, index(after i: Int) -&gt; indices: DefaultIndices</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">subscript</span>(position: <span style="color: #703daa" class="">Int</span>) -&gt; <span style="color: #703daa" class="">Void</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ba2da2" class="">return</span>&nbsp;<font color="#d12f1b" class="">()</font></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div></blockquote><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px;" class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(79, 129, 135);" class=""><span style="color: rgb(186, 45, 162);" class="">let</span>&nbsp;b&nbsp;=&nbsp;MyCollectionB()</div></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">b.count // !! Fetal Error:&nbsp;<span style="color: rgb(3, 47, 98); font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 12px; white-space: pre;" class="">Only BidirectionalCollections can have end come before start</span></div></div></blockquote></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div></div></body></html>