<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="">Thanks&nbsp;Xiaodi for so kindly bringing me up to speed.&nbsp;<div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><span class="" style="font-size: inherit; float: none; display: inline !important;">This thread is really long and hard to&nbsp;</span><span class="" style="font-size: inherit; float: none; display: inline !important;">follow</span></blockquote><div class="">To my great embarrassment, I have only subsequent to my post realised that people kept returning to this thread and that I have as a result only seen the first burst of activity. Sincere apologies!!</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><span class="" style="font-size: inherit; float: none; display: inline !important;">See if you&nbsp;</span><span class="" style="font-size: inherit; float: none; display: inline !important;">like where things are headed.</span></blockquote>Yes. Especially Dave A’s brainwave that:</div><div class=""><span style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><span style="white-space: pre-wrap;" class="">    Hmm, instead of defining a new protocol (Countable),&nbsp;</span></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><span style="white-space: pre-wrap;" class="">    what if we just use “Strideable where Stride : Integer”</span></span></div><div class=""><div class=""><br class=""></div></div><div class=""><blockquote type="cite" class=""><span class="" style="font-size: inherit; float: none; display: inline !important;">An older syntax is being restored in Swift 3: `stride(from: 1, to: 5,&nbsp;</span><span class="" style="font-size: inherit; float: none; display: inline !important;">by: 2)` and `stride(from: 1, through: 5, by: 2)`</span></blockquote>This is ok. But it is also *only* ok… It does not mach the sheer sweetness of interval operators or the nil coalescing operator. It is not so Switly that such a common pattern makes me think of equivalent syntax in other languages with longing… In other words, I definitely think an operator-only syntax would be an irresistible alternative in almost every use case – if we could only come up with such operators without trespassing over existing API.</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><blockquote type="cite" class="">3. The direction in which we advance from one end to another of the interval&nbsp;is provided twice: once by the order of the bounds and then again by the&nbsp;sign of the stride argument.</blockquote></blockquote><blockquote type="cite" class=""><span class="" style="font-size: inherit; float: none; display: inline !important;">The stride direction is strictly given by the sign of the last&nbsp;</span><span class="" style="font-size: inherit; float: none; display: inline !important;">argument; `stride(from: 1, to: -5, by: 2)` is an empty sequence,&nbsp;</span><span class="" style="font-size: inherit; float: none; display: inline !important;">because you cannot get from start to end by -2. See next comment for&nbsp;</span><span class="" style="font-size: inherit; float: none; display: inline !important;">why I think this is a feature, not a bug.</span></blockquote>Personally, I think that both semantics are valid – i.e. I’m not persuaded that the latter is necessarily more intuitive or practical. There is some merit too in starting with an interval (requiring interval.start &lt;= interval.end), that the stride argument is of type Self.Distance not Self.Stride, so that the stride direction is explicitly opted for once at the call site – e.g. alongs the lines of (with a better choice of the operator eventually):</div><div class=""><br class=""></div><div class=""><div class=""><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">for</span>&nbsp;i&nbsp;<span style="color: rgb(200, 172, 229);" class="">in</span>&nbsp;<span style="color: rgb(255, 38, 0);" class="">1</span>...<span style="color: rgb(255, 38, 0);" class="">5</span>&nbsp;<span style="color: rgb(145, 84, 15);" class="">&gt;</span>&nbsp;<span style="color: rgb(255, 38, 0);" class="">2</span>&nbsp;{</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(203, 203, 203);" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(0, 0, 0);" class="">i&nbsp;</span>// 1, 3, 5</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span>}</div></div></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">&nbsp; &nbsp; for</span> i <span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">in</span> <span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">1</span>...<span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">5</span> <span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">&lt;</span> <span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">2</span> {</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(203, 203, 203);" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(0, 0, 0);" class="">i </span>// 5, 3, 1</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span>}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;" class=""><br class=""></div></div><div style="margin: 0px; line-height: normal; min-height: 15px;" class="">This would still produce empty sequences when the stride is not taking you towards the end bound, but it might be argued that it also simplifies the mental model of what is going on: “there is this interval and I want to loop through it forwards or backwards with that step size”. Omitting the second operator and the last argument would default to the unit definition for the bound type (e.g.&nbsp;<span style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">“where Stride : Integer”)</span>, else this would emit a compile time error.</div><div style="margin: 0px; line-height: normal; min-height: 15px;" class=""><br class=""></div><div class=""><blockquote type="cite" class=""><span class="" style="font-size: inherit; float: none; display: inline !important;">Dave&nbsp;</span><span class="" style="font-size: inherit; float: none; display: inline !important;">A is making some big changes to Range (and Intervals are going away,&nbsp;</span><span style="font-size: inherit;" class="">leaving only Range)</span></blockquote><div class="">and</div><blockquote type="cite" class="">`Range.striding(by:)`&nbsp;…&nbsp;</blockquote>I like this in principle, depending on what `Range` ends up becoming… For Swift 2, I definitely prefer never touching the `Range` struct:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">&nbsp; &nbsp; extension</span> <span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">ClosedInterval</span> <span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">where</span> Bound : Strideable {</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">func</span> stride(by stride: <span style="color: rgb(73, 162, 210);" class="">Bound</span>.Stride) -&gt; <span style="color: rgb(73, 162, 210);" class="">StrideThrough</span>&lt;<span style="color: rgb(73, 162, 210);" class="">Bound</span>&gt; {</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">let</span> (s, e) = stride <span style="color: rgb(145, 84, 15);" class="">&lt;</span> <span style="color: rgb(255, 38, 0);" class="">0</span> ? (<span style="color: rgb(143, 121, 58);" class="">end</span>, <span style="color: rgb(143, 121, 58);" class="">start</span>) : (<span style="color: rgb(143, 121, 58);" class="">start</span>, <span style="color: rgb(143, 121, 58);" class="">end</span>)</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">return</span> s.<span style="color: rgb(145, 84, 15);" class="">stride</span>(through: e, by: stride)</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span>}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span>}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">extension</span> <span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">HalfOpenInterval</span> <span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">where</span> Bound : Strideable {</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">func</span> stride(by stride: <span style="color: rgb(73, 162, 210);" class="">Bound</span>.Stride) -&gt; <span style="color: rgb(73, 162, 210);" class="">StrideTo</span>&lt;<span style="color: rgb(73, 162, 210);" class="">Bound</span>&gt; {</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">let</span> (s, e) = stride <span style="color: rgb(145, 84, 15);" class="">&lt;</span> <span style="color: rgb(255, 38, 0);" class="">0</span> ? (<span style="color: rgb(143, 121, 58);" class="">end</span>, <span style="color: rgb(143, 121, 58);" class="">start</span>) : (<span style="color: rgb(143, 121, 58);" class="">start</span>, <span style="color: rgb(143, 121, 58);" class="">end</span>)</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">return</span> s.<span style="color: rgb(145, 84, 15);" class="">stride</span>(to: e, by: stride)</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span>}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span>}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">1</span>...<span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">5</span>).<span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">stride</span>(by: <span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">2</span>)&nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #cbcbcb" class="">// 1, 3, 5</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">1</span>..&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">5</span>).<span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">stride</span>(by: <span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">2</span>)&nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #cbcbcb" class="">// 1, 3</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">1</span>...<span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">5</span>).<span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">stride</span>(by: -<span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">2</span>) <span style="font-variant-ligatures: no-common-ligatures; color: #cbcbcb" class="">// 5, 3, 1</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="color: rgb(200, 172, 229);" class="">&nbsp; &nbsp;</span><span style="color: rgb(200, 172, 229);" class="">&nbsp;</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">1</span>..&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">5</span>).<span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">stride</span>(by: -<span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">2</span>) <span style="font-variant-ligatures: no-common-ligatures; color: #cbcbcb" class="">// 5, 3</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures; color: #cbcbcb" class=""><br class=""></span></div><div class="">Again, many thanks for your kind reply.</div><div class=""><br class=""></div><div class="">milos</div><br class=""><div><blockquote type="cite" class=""><div class="">On 3 Apr 2016, at 06:17, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Milos, you make good points. This thread is really long and hard to</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">follow, so I'll reply inline below with some observations that have</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">been made in the past, which I think address some of them. See if you</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">like where things are headed.</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On Sat, Apr 2, 2016 at 8:05 PM, Milos Rankovic via swift-evolution</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&lt;</span><a href="mailto:swift-evolution@swift.org" style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&gt; wrote:</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">`Strideable` types represent an often needed generalisation of `Range` and<br class="">`IntervalType`s. However, `Strideable`’s two `stride` methods are far too<br class="">verbose and unbalanced (in contrast to the natural look and feel of the two<br class="">interval operators). Examples like the following raise a number of issues:<br class=""><br class="">&nbsp;&nbsp;&nbsp;1.stride(through: 5, by: 2) &nbsp;// 1, 3, 5<br class=""><br class="">&nbsp;&nbsp;&nbsp;1.stride(through: 5, by: -2) // []<br class=""><br class="">1. The method's verbosity keeps the bounds too far apart.<br class=""><br class="">2. The dot syntax suggests that something is being done to the start bound,<br class="">with the end bound playing the role of an argument, all of which does not<br class="">really reflect the semantics of the call.<br class=""></blockquote><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">An older syntax is being restored in Swift 3: `stride(from: 1, to: 5,</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">by: 2)` and `stride(from: 1, through: 5, by: 2)`, and dot syntax is</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">being removed. Bounds are now next to each other, and the start and</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">end values are now visually equals.</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">3. The direction in which we advance from one end to another of the interval<br class="">is provided twice: once by the order of the bounds and then again by the<br class="">sign of the stride argument.<br class=""></blockquote><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The stride direction is strictly given by the sign of the last</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">argument; `stride(from: 1, to: -5, by: 2)` is an empty sequence,</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">because you cannot get from start to end by -2. See next comment for</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">why I think this is a feature, not a bug.</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">4. Given the conceptual proximity of `Strideable`, `IntervalType` and<br class="">`Range`, one would expect analogous ways of constructing them.<br class=""><br class="">5. The word “stride” is not particularly friendly to programmers whose first<br class="">language is not English (again in contrast to the interval operators). This<br class="">is compounded by the distinction between `to` and `through` parameters.<br class=""><br class="">As already noted in this thread, we could simply extend the existing types:<br class=""><br class="">&nbsp;&nbsp;&nbsp;extension ClosedInterval where Bound : Strideable {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;func by(stride: Bound.Stride) -&gt; StrideThrough&lt;Bound&gt; {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;let (s, e) = stride &lt; 0 ? (end, start) : (start, end)<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return s.stride(through: e, by: stride)<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="">&nbsp;&nbsp;&nbsp;}<br class=""><br class="">&nbsp;&nbsp;&nbsp;extension HalfOpenInterval where Bound : Strideable {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;func by(stride: Bound.Stride) -&gt; StrideTo&lt;Bound&gt; {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;let (s, e) = stride &lt; 0 ? (end, start) : (start, end)<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return s.stride(to: e, by: stride)<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="">&nbsp;&nbsp;&nbsp;}<br class=""><br class="">So that:<br class=""><br class="">&nbsp;&nbsp;&nbsp;(1...5).by(2) &nbsp;// 1, 3, 5<br class="">&nbsp;&nbsp;&nbsp;(1..&lt;5).by(2) &nbsp;// 1, 3<br class=""><br class="">&nbsp;&nbsp;&nbsp;(1...5).by(-2) // 5, 3, 1<br class="">&nbsp;&nbsp;&nbsp;(1..&lt;5).by(-2) // 5, 3<br class=""></blockquote><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Yes, I do think that's a great idea, as do other people! Because Dave</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">A is making some big changes to Range (and Intervals are going away,</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">leaving only Range), I haven't tried to extend Range in my last</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">proof-of-concept, but I think there's momentum to add a</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">`striding(by:)` method to Range to do exactly that, `striding(by:)`</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">being more clear than `by(_:)`.</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">One difference between `Range.striding(by:)` and `stride(from:to:by:)`</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">will be that it's a fatal error to try to construct `1..&lt;(-5)` as a</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Range, but if you read the comments in the code for StrideTo, the</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">original designers of stride explicitly wanted `stride(from: 1, to:</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">-5, by: 1)` to be allowed. When you can't get from start to end by the</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">chosen stride, the result is an empty sequence instead of a fatal</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">error. There may be use cases where that behavior is preferred, so I'm</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">in favor of adding `striding(by:)` to Range but also keeping</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">`stride(...)`.</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">More exotically, we could make use of subscripts:<br class=""><br class="">&nbsp;&nbsp;&nbsp;extension ClosedInterval where Bound : Strideable {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subscript(stride: Bound.Stride) -&gt; StrideThrough&lt;Bound&gt; {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return by(stride)<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="">&nbsp;&nbsp;&nbsp;}<br class=""><br class="">&nbsp;&nbsp;&nbsp;extension HalfOpenInterval where Bound : Strideable {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subscript(stride: Bound.Stride) -&gt; StrideTo&lt;Bound&gt; {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return by(stride)<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="">&nbsp;&nbsp;&nbsp;}<br class=""><br class="">&nbsp;&nbsp;&nbsp;(1...5)[-2] // 5, 3, 1<br class=""><br class="">Or introduce a new, or overload an existing operator, with precedence just<br class="">lower than the two interval operators. For example:<br class=""><br class="">&nbsp;&nbsp;&nbsp;func &gt; &lt;T&gt; (i: ClosedInterval&lt;T&gt;, stride: T.Stride) -&gt; StrideThrough&lt;T&gt;<br class="">{<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return i.start.stride(through: i.end, by: stride)<br class="">&nbsp;&nbsp;&nbsp;}<br class=""><br class="">&nbsp;&nbsp;&nbsp;func &lt; &lt;T&gt; (i: ClosedInterval&lt;T&gt;, stride: T.Stride) -&gt; StrideThrough&lt;T&gt;<br class="">{<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return i.end.stride(through: i.start, by: -stride)<br class="">&nbsp;&nbsp;&nbsp;}<br class=""><br class="">&nbsp;&nbsp;&nbsp;func &gt; &lt;T&gt; (i: HalfOpenInterval&lt;T&gt;, stride: T.Stride) -&gt; StrideTo&lt;T&gt; {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return i.start.stride(to: i.end, by: stride)<br class="">&nbsp;&nbsp;&nbsp;}<br class=""><br class="">&nbsp;&nbsp;&nbsp;func &lt; &lt;T&gt; (i: HalfOpenInterval&lt;T&gt;, stride: T.Stride) -&gt; StrideTo&lt;T&gt; {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return i.end.stride(to: i.start, by: -stride)<br class="">&nbsp;&nbsp;&nbsp;}<br class=""><br class="">&nbsp;&nbsp;&nbsp;for i in 1...5 &lt; 2 {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i // 5, 3, 1<br class="">&nbsp;&nbsp;&nbsp;}<br class=""><br class="">&nbsp;&nbsp;&nbsp;for i in 1...5 &gt; 2 {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i // 1, 3, 5<br class="">&nbsp;&nbsp;&nbsp;}<br class=""></blockquote><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I've suggested something like that to be possible earlier in the</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">thread; didn't get too much of a positive reception. People seem to</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: -webkit-standard; font-size: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">like `by(_:)` or `striding(by:)` though.</span><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: -webkit-standard; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="">Not to mention a C-style `for` loop lookalike:<br class=""><br class="">&nbsp;&nbsp;&nbsp;for i in (1 to 5 by 2) {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i // 1, 3, 5<br class="">&nbsp;&nbsp;&nbsp;}<br class=""><br class="">Obviously, this whole thread is related to the C-style `for` loop (which is<br class="">more general than all of the above solutions) as well as to Haskell-style<br class="">list comprehension syntax (which remains enviable). Nevertheless, I do think<br class="">that a focused, lightweight feature would be the best fit for such a common<br class="">need (just think, for example, how often are such sequences used for<br class="">instructional purposes).<br class=""><br class="">One other possibility is to introduce open-ended, infinite sequences defined<br class="">by a single bound and a stride:<br class=""><br class="">&nbsp;&nbsp;&nbsp;// infinite sequence, starting with 5 and advancing by -2<br class="">&nbsp;&nbsp;&nbsp;(5..|-2)<br class=""><br class="">… which could be optionally closed by one of the interval operators:<br class=""><br class="">&nbsp;&nbsp;&nbsp;(5..|-2)...1<br class=""><br class="">I’ve read somewhere that the “interval is going away”, in which case, a new<br class="">tertiary operator may be worth considering since striding is such a<br class="">fundamental operation. Or really any of the above – just not sticking to the<br class="">existing `stride` methods!<br class=""><br class="">milos<br class=""><br class="">_______________________________________________<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</blockquote></div></blockquote></div><br class=""></div></body></html>