<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=""><div class=""><font face="Times" class="">`</font><span class="" style="color: rgb(73, 162, 210); font-family: 'Source Code Pro'; font-size: 12px;">Strideable</span><span class="" style="font-family: Times;">`</span><span class="" style="font-family: Times;"> types represent an often needed generalisation of </span><font face="Times" class="">`</font><span class="" style="color: rgb(73, 162, 210); font-family: 'Source Code Pro'; font-size: 12px;">Range</span><span class="" style="font-family: Times;">` and </span><font face="Times" class="">`</font><span class="" style="color: rgb(73, 162, 210); font-family: 'Source Code Pro'; font-size: 12px;">IntervalType</span><span class="" style="font-family: Times;">`s. However, </span><font face="Times" class="">`</font><span class="" style="color: rgb(73, 162, 210); font-family: 'Source Code Pro'; font-size: 12px;">Strideable</span><font face="Times" class="">`’s</font><span class="" style="font-family: Times;"> </span><font face="Times" class="">two </font><font face="Times" class="">`</font><span class="" style="color: rgb(145, 84, 15); font-family: 'Source Code Pro'; font-size: 12px;">stride</span><span class="" style="font-family: Times;">`</span><font face="Times" class=""> methods are far too verbose and unbalanced (in contrast to the natural look and feel of the two interval operators). Examples like the following raise a number of issues:</font></div><div class=""><font face="Times" class=""><br class=""></font></div><div class=""><div class=""><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(255, 38, 0);">1</span>.<span class="" style="color: rgb(145, 84, 15);">stride</span>(through: <span class="" style="color: rgb(255, 38, 0);">5</span>, by: <span class="" style="color: rgb(255, 38, 0);">2</span>) <span class="" style="color: rgb(203, 203, 203);">// 1, 3, 5</span></div></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(203, 203, 203);"><br class=""></span></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><div class="" style="margin: 0px; line-height: normal;"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(255, 38, 0);">1</span>.<span class="" style="color: rgb(145, 84, 15);">stride</span>(through: <span class="" style="color: rgb(255, 38, 0);">5</span>, by: -<span class="" style="color: rgb(255, 38, 0);">2</span>) <span class="" style="color: rgb(203, 203, 203);">// []</span></div><div class=""><span class="" style="color: rgb(203, 203, 203);"><br class=""></span></div></div></div><div class=""><font face="Times" class="">1. </font><span class="" style="font-family: Times;">The method's verbosity keeps the bounds too far apart. </span></div><div class=""><span class="" style="font-family: Times;"><br class=""></span></div><div class=""><span class="" style="font-family: Times;">2. The dot syntax suggests that something is being done to the start bound, with the end bound playing the role of an argument, all of which does not really reflect the semantics of the call.</span></div><div class=""><span class="" style="font-family: Times;"><br class=""></span></div><div class=""><span class="" style="font-family: Times;">3. The direction in which we advance from one end to another of the interval is provided twice: once by the order of the bounds and then again by the sign of the stride argument.</span></div><div class=""><span class="" style="font-family: Times;"><br class=""></span></div><div class=""><font face="Times" class="">4. Given the conceptual proximity of </font><font face="Times" class="">`</font><span class="" style="color: rgb(73, 162, 210); font-family: 'Source Code Pro'; font-size: 12px;">Strideable</span><span class="" style="font-family: Times;">`,</span><span class="" style="font-family: Times;"> </span><font face="Times" class="">`</font><span class="" style="color: rgb(73, 162, 210); font-family: 'Source Code Pro'; font-size: 12px;">IntervalType</span><span class="" style="font-family: Times;">` and </span><font face="Times" class="">`</font><span class="" style="color: rgb(73, 162, 210); font-family: 'Source Code Pro'; font-size: 12px;">Range</span><span class="" style="font-family: Times;">`, one would expect analogous ways of constructing them.</span></div><div class=""><font face="Times" class=""><br class=""></font></div><div class=""><font face="Times" class="">5. </font><span class="" style="font-family: Times;">The word “</span><span class="" style="color: rgb(145, 84, 15); font-family: 'Source Code Pro'; font-size: 12px;">stride</span><span class="" style="font-family: Times;">” is not particularly friendly to programmers whose first language is not English (again in contrast to the interval operators). This is compounded by the distinction between `</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;">to</span><span class="" style="font-family: Times;">` and `</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;">through</span><span class="" style="font-family: Times;">` parameters.</span></div><div class=""><span class="" style="font-family: Times;"><br class=""></span></div><div class=""><span class="" style="font-family: Times;">As already noted in this thread, we could simply extend the existing types:</span></div><div class=""><span class="" style="font-family: Times;"><br class=""></span></div><div class=""><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">extension</span> <span class="" style="color: rgb(73, 162, 210);">ClosedInterval</span> <span class="" style="color: rgb(200, 172, 229);">where</span> Bound : Strideable {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">func</span> by(stride: <span class="" style="color: rgb(73, 162, 210);">Bound</span>.Stride) -> <span class="" style="color: rgb(73, 162, 210);">StrideThrough</span><<span class="" style="color: rgb(73, 162, 210);">Bound</span>> {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">let</span> (s, e) = stride <span class="" style="color: rgb(145, 84, 15);"><</span> <span class="" style="color: rgb(255, 38, 0);">0</span> ? (<span class="" style="color: rgb(143, 121, 58);">end</span>, <span class="" style="color: rgb(143, 121, 58);">start</span>) : (<span class="" style="color: rgb(143, 121, 58);">start</span>, <span class="" style="color: rgb(143, 121, 58);">end</span>)</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">return</span> s.<span class="" style="color: rgb(145, 84, 15);">stride</span>(through: e, by: stride)</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;"><span class="" style="color: rgb(200, 172, 229);"><br class=""></span></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">extension</span> <span class="" style="color: rgb(73, 162, 210);">HalfOpenInterval</span> <span class="" style="color: rgb(200, 172, 229);">where</span> Bound : Strideable {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">func</span> by(stride: <span class="" style="color: rgb(73, 162, 210);">Bound</span>.Stride) -> <span class="" style="color: rgb(73, 162, 210);">StrideTo</span><<span class="" style="color: rgb(73, 162, 210);">Bound</span>> {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">let</span> (s, e) = stride <span class="" style="color: rgb(145, 84, 15);"><</span> <span class="" style="color: rgb(255, 38, 0);">0</span> ? (<span class="" style="color: rgb(143, 121, 58);">end</span>, <span class="" style="color: rgb(143, 121, 58);">start</span>) : (<span class="" style="color: rgb(143, 121, 58);">start</span>, <span class="" style="color: rgb(143, 121, 58);">end</span>)</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">return</span> s.<span class="" style="color: rgb(145, 84, 15);">stride</span>(to: e, by: stride)</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div></div><div class=""><br class=""></div><div class="">So that:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(203, 203, 203);"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(0, 0, 0);">(</span><span class="" style="color: rgb(255, 38, 0);">1</span><span class="" style="color: rgb(0, 0, 0);">...</span><span class="" style="color: rgb(255, 38, 0);">5</span><span class="" style="color: rgb(0, 0, 0);">).</span><span class="" style="color: rgb(145, 84, 15);">by</span><span class="" style="color: rgb(0, 0, 0);">(</span><span class="" style="color: rgb(255, 38, 0);">2</span><span class="" style="color: rgb(0, 0, 0);">) </span>// 1, 3, 5</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>(<span class="" style="color: rgb(255, 38, 0);">1</span>..<<span class="" style="color: rgb(255, 38, 0);">5</span>).<span class="" style="color: rgb(145, 84, 15);">by</span>(<span class="" style="color: rgb(255, 38, 0);">2</span>) <span class="" style="color: rgb(203, 203, 203);">// 1, 3</span></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;"><br class=""></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(203, 203, 203);"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(0, 0, 0);">(</span><span class="" style="color: rgb(255, 38, 0);">1</span><span class="" style="color: rgb(0, 0, 0);">...</span><span class="" style="color: rgb(255, 38, 0);">5</span><span class="" style="color: rgb(0, 0, 0);">).</span><span class="" style="color: rgb(145, 84, 15);">by</span><span class="" style="color: rgb(0, 0, 0);">(-</span><span class="" style="color: rgb(255, 38, 0);">2</span><span class="" style="color: rgb(0, 0, 0);">) </span>// 5, 3, 1</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>(<span class="" style="color: rgb(255, 38, 0);">1</span>..<<span class="" style="color: rgb(255, 38, 0);">5</span>).<span class="" style="color: rgb(145, 84, 15);">by</span>(-<span class="" style="color: rgb(255, 38, 0);">2</span>) <span class="" style="color: rgb(203, 203, 203);">// 5, 3</span></div></div><div class=""><span class="" style="color: rgb(203, 203, 203);"><br class=""></span></div><div class="">More exotically, we could make use of subscripts:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">extension</span> <span class="" style="color: rgb(73, 162, 210);">ClosedInterval</span> <span class="" style="color: rgb(200, 172, 229);">where</span> Bound : Strideable {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">subscript</span>(stride: <span class="" style="color: rgb(73, 162, 210);">Bound</span>.Stride) -> <span class="" style="color: rgb(73, 162, 210);">StrideThrough</span><<span class="" style="color: rgb(73, 162, 210);">Bound</span>> {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">return</span> <span class="" style="color: rgb(145, 84, 15);">by</span>(stride)</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;"><br class=""></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">extension</span> <span class="" style="color: rgb(73, 162, 210);">HalfOpenInterval</span> <span class="" style="color: rgb(200, 172, 229);">where</span> Bound : Strideable {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">subscript</span>(stride: <span class="" style="color: rgb(73, 162, 210);">Bound</span>.Stride) -> <span class="" style="color: rgb(73, 162, 210);">StrideTo</span><<span class="" style="color: rgb(73, 162, 210);">Bound</span>> {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">return</span> <span class="" style="color: rgb(145, 84, 15);">by</span>(stride)</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div></div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>(<span class="" style="color: rgb(255, 38, 0);">1</span>...<span class="" style="color: rgb(255, 38, 0);">5</span>)<span class="" style="color: rgb(145, 84, 15);">[</span>-<span class="" style="color: rgb(255, 38, 0);">2</span><span class="" style="color: rgb(145, 84, 15);">] </span><span class="" style="color: rgb(203, 203, 203);">// 5, 3, 1</span></div></div><div class=""><br class=""></div><div class="">Or introduce a new, or overload an existing operator, with precedence just lower than the two interval operators. For example:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">func</span> > <T> (i: <span class="" style="color: rgb(73, 162, 210);">ClosedInterval</span><<span class="" style="color: rgb(73, 162, 210);">T</span>>, stride: <span class="" style="color: rgb(73, 162, 210);">T</span>.Stride) -> <span class="" style="color: rgb(73, 162, 210);">StrideThrough</span><<span class="" style="color: rgb(73, 162, 210);">T</span>> {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">return</span> i.<span class="" style="color: rgb(143, 121, 58);">start</span>.<span class="" style="color: rgb(145, 84, 15);">stride</span>(through: i.<span class="" style="color: rgb(143, 121, 58);">end</span>, by: stride)</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;"><br class=""></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">func</span> < <T> (i: <span class="" style="color: rgb(73, 162, 210);">ClosedInterval</span><<span class="" style="color: rgb(73, 162, 210);">T</span>>, stride: <span class="" style="color: rgb(73, 162, 210);">T</span>.Stride) -> <span class="" style="color: rgb(73, 162, 210);">StrideThrough</span><<span class="" style="color: rgb(73, 162, 210);">T</span>> {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">return</span> i.<span class="" style="color: rgb(143, 121, 58);">end</span>.<span class="" style="color: rgb(145, 84, 15);">stride</span>(through: i.<span class="" style="color: rgb(143, 121, 58);">start</span>, by: <span class="" style="color: rgb(145, 84, 15);">-</span>stride)</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;"><br class=""></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">func</span> > <T> (i: <span class="" style="color: rgb(73, 162, 210);">HalfOpenInterval</span><<span class="" style="color: rgb(73, 162, 210);">T</span>>, stride: <span class="" style="color: rgb(73, 162, 210);">T</span>.Stride) -> <span class="" style="color: rgb(73, 162, 210);">StrideTo</span><<span class="" style="color: rgb(73, 162, 210);">T</span>> {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">return</span> i.<span class="" style="color: rgb(143, 121, 58);">start</span>.<span class="" style="color: rgb(145, 84, 15);">stride</span>(to: i.<span class="" style="color: rgb(143, 121, 58);">end</span>, by: stride)</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;"><br class=""></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">func</span> < <T> (i: <span class="" style="color: rgb(73, 162, 210);">HalfOpenInterval</span><<span class="" style="color: rgb(73, 162, 210);">T</span>>, stride: <span class="" style="color: rgb(73, 162, 210);">T</span>.Stride) -> <span class="" style="color: rgb(73, 162, 210);">StrideTo</span><<span class="" style="color: rgb(73, 162, 210);">T</span>> {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">return</span> i.<span class="" style="color: rgb(143, 121, 58);">end</span>.<span class="" style="color: rgb(145, 84, 15);">stride</span>(to: i.<span class="" style="color: rgb(143, 121, 58);">start</span>, by: <span class="" style="color: rgb(145, 84, 15);">-</span>stride)</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div></div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">for</span> i <span class="" style="color: rgb(200, 172, 229);">in</span> <span class="" style="color: rgb(255, 38, 0);">1</span>...<span class="" style="color: rgb(255, 38, 0);">5</span> <span class="" style="color: rgb(145, 84, 15);"><</span> <span class="" style="color: rgb(255, 38, 0);">2</span> {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(203, 203, 203);"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(0, 0, 0);">i </span>// 5, 3, 1</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;"><br class=""></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">for</span> i <span class="" style="color: rgb(200, 172, 229);">in</span> <span class="" style="color: rgb(255, 38, 0);">1</span>...<span class="" style="color: rgb(255, 38, 0);">5</span> <span class="" style="color: rgb(145, 84, 15);">></span> <span class="" style="color: rgb(255, 38, 0);">2</span> {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(203, 203, 203);"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(0, 0, 0);">i </span>// 1, 3, 5</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div></div><div class=""><br class=""></div><div class="">Not to mention a C-style `for` loop lookalike:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);">for</span> i <span class="" style="color: rgb(200, 172, 229);">in</span> (<span class="" style="color: rgb(255, 38, 0);">1</span> <span class="" style="color: rgb(200, 172, 229);">to</span> <span class="" style="color: rgb(255, 38, 0);">5</span> <span class="" style="color: rgb(200, 172, 229);">by</span> <span class="" style="color: rgb(255, 38, 0);">2</span>) {</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(203, 203, 203);"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(0, 0, 0);">i </span>// 1, 3, 5</div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>}</div></div><div class=""><br class=""></div><div class="">Obviously, this whole thread is related to the C-style `for` loop (which is more general than all of the above solutions) as well as to Haskell-style list comprehension syntax (which remains enviable). Nevertheless, I do think that a focused, lightweight feature would be the best fit for such a common need (just think, for example, how often are such sequences used for instructional purposes).</div><div class=""><br class=""></div><div class="">One other possibility is to introduce open-ended, infinite sequences defined by a single bound and a stride:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><div class="" style="margin: 0px; line-height: normal; color: rgb(203, 203, 203);"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>// infinite sequence, starting with 5 and advancing by -2</div></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>(<span class="" style="color: rgb(255, 38, 0);">5</span>..|-<span class="" style="color: rgb(255, 38, 0);">2</span>)</div></div><div class=""><br class=""></div><div class="">… which could be optionally closed by one of the interval operators:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="color: rgb(200, 172, 229);"> </span><span class="" style="color: rgb(200, 172, 229);"> </span>(<span class="" style="color: rgb(255, 38, 0);">5</span>..|-<span class="" style="color: rgb(255, 38, 0);">2</span>)...<span class="" style="color: rgb(255, 38, 0);">1</span></div></div><div class=""><br class=""></div><div class="">I’ve read somewhere that the “interval is going away”, in which case, a new tertiary operator may be worth considering since striding is such a fundamental operation. Or really any of the above – just not sticking to the existing `<span class="" style="color: rgb(145, 84, 15); font-family: 'Source Code Pro'; font-size: 12px;">stride</span>` methods!</div><div class=""><br class=""></div><div class="">milos</div></body></html>