<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 30, 2016, at 4:10 AM, Brent Royal-Gordon 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=""><div class=""><blockquote type="cite" class="">The core team believes that the existing strideable API cannot efficiently and correctly handle all the real-world use cases one would want. &nbsp;However, a multiplication-based implementation similar to the one proposed in SE-0050 (but potentially extended) seems sufficiently general to solve the existing use cases as well as solve the floating point error accumulation issue. &nbsp;Once the design of this iterates on swift-evolution, it would be great to see a revised version of this proposal.<br class=""></blockquote><br class="">Can you give any indication of what's wrong with the proposed API?<br class=""></div></div></blockquote></div><br class=""><div class="">Piling on because it would really help to get a sense of what direction the core team is looking for. U<span style="font-family: Palatino-Roman;" class="">nless we can figure out in advance what the core team is actually looking for, it's hard to respond with the request for revision. The f</span><span style="font-family: Palatino-Roman;" class="">eedback says: "they don't think this API change is the right approach" and "</span><font face="Palatino-Roman" class="">The core team believes that the existing strideable API cannot efficiently and correctly handle all the real-world use cases one would want."&nbsp;</font></div><div class=""><span style="font-family: Palatino-Roman;" class=""><br class=""></span></div><div class=""><span style="font-family: Palatino-Roman;" class="">I'd like to iterate the design as requested, but it's hard to know where to start. So let me discuss things that can be strode along:</span></div><div class=""><br class=""></div><div class="">There are four types of <i class="">bounded intervals</i>&nbsp;<span style="font-family: Palatino-Roman;" class="">(open and closed on each end) that can be traversed in either direction, four types of <i class="">unbounded interval</i> (open and closed starting points, heading positively and negatively), and both integer and floating point applications of strides along these:</span></div><div class=""><span style="font-family: Palatino-Roman;" class=""><br class=""></span></div><div class=""><span style="font-family: Palatino-Roman;" class="">Bounded Intervals: [A, B),&nbsp;</span><span style="font-family: Palatino-Roman;" class="">(A, B],&nbsp;</span><span style="font-family: Palatino-Roman;" class="">(A, B),&nbsp;</span><span style="font-family: Palatino-Roman;" class="">[A, B]</span></div><div class=""><span style="font-family: Palatino-Roman;" class="">Unbounded Intervals: (A, ∞), [A,&nbsp;</span><span style="font-family: Palatino-Roman;" class="">&nbsp;</span><span style="font-family: Palatino-Roman;" class="">∞), (</span><span style="font-family: Palatino-Roman;" class="">&nbsp;-</span><span style="font-family: Palatino-Roman;" class="">∞, A), (</span><span style="font-family: Palatino-Roman;" class="">-</span><span style="font-family: Palatino-Roman;" class="">∞, A]</span></div><div class=""><span style="font-family: Palatino-Roman;" class=""><br class=""></span></div><div class=""><span style="font-family: Palatino-Roman;" class="">(Technically, there's also the empty interval (), and the full number line (-</span><span style="font-family: Palatino-Roman;" class="">∞</span><span style="font-family: Palatino-Roman;" class="">,&nbsp;</span><span style="font-family: Palatino-Roman;" class="">∞</span><span style="font-family: Palatino-Roman;" class="">), which really don't come into play for sequences but might play a role in pattern matching.)</span></div><div class=""><span style="font-family: Palatino-Roman;" class=""><br class=""></span></div><div class=""><span style="font-family: Palatino-Roman;" class="">The simplest API to handle <i class="">all</i> these cases would be:</span></div><div class=""><span style="font-family: Palatino-Roman;" class=""><br class=""></span></div><div class=""><ul class="MailOutline"><li class=""><span style="font-family: Palatino-Roman;" class="">`</span><font face="Menlo" class="">stride(from/off:, by:, towards/to/through:)`&nbsp;</font><span style="font-family: Palatino-Roman;" class="">for sequences along bounded intervals and&nbsp;</span></li><li class="">`<font face="Menlo" class="">stride(from/</font><span style="font-family: Menlo;" class="">off</span><font face="Menlo" class="">:, by:)</font><span style="font-family: Palatino-Roman;" class="">` for sequences along unbounded intervals.&nbsp;</span></li></ul></div><div class=""><br class=""></div><div class="">In these calls, `from` is inclusive and `off` is exclusive of the first value.</div><div class=""><br class=""></div><div class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0051-stride-semantics.md" class="" style="font-family: Palatino-Roman;">SE-0051</a><span style="font-family: Palatino-Roman;" class="">&nbsp;covers the details of what the semantics of `</span><font face="Menlo" class="">towards</font><span style="font-family: Palatino-Roman;" class="">`/`</span><font face="Menlo" class="">to</font><span style="font-family: Palatino-Roman;" class="">`/`</span><font face="Menlo" class="">through</font><span style="font-family: Palatino-Roman;" class="">` mean:&nbsp;</span></div><div class=""><span style="font-family: Palatino-Roman;" class=""><br class=""></span></div><div class=""><ul class="MailOutline"><li class=""><font face="Palatino-Roman" class=""><i class="">towards</i>&nbsp;meaning a..&lt;b, a&lt;..b, for example: 1 towards 5 by 1 is [1, 2, 3, 4]</font></li><li class=""><font face="Palatino-Roman" class=""><i class="">to</i>&nbsp;a...b, for example: 1 to 5 by 1 is [1, 2, 3, 4, 5], and 1 to 10 by 8 is [1, 9]</font></li><li class=""><font face="Palatino-Roman" class=""><i class="">through</i>&nbsp;a..&gt;=b, a&gt;=..b, for example: 1 through 5 by 1 is [1, 2, 3, 4, 5] and 1 through 10 by 8 is [1, 9, 17]</font></li></ul></div><div class=""><br class=""></div><div class=""><div class=""><span style="font-family: Palatino-Roman;" class="">The acceptance of SE-0045 and SE-0099 and makes implementing each of these sequence types much easier. &nbsp;The state version can use the error-reducing iteration multiplier. The non-state version is perfect for integer math.</span></div></div><div class=""><span style="font-family: Palatino-Roman;" class=""><br class=""></span></div><div class=""><span style="font-family: Palatino-Roman;" class="">-- E</span></div></body></html>