<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 Apr 6, 2016, at 3:05 PM, Dave Abrahams via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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 Wed Apr 06 2016, Xiaodi Wu &lt;</span><a href="http://xiaodi.wu-at-gmail.com/" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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="">xiaodi.wu-AT-gmail.com</a><span style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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="">On Wed, Apr 6, 2016 at 3:28 PM, Dave Abrahams via swift-evolution<br class="">&lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><blockquote type="cite" class="">You if you need to represent `&lt;..` intervals in scientific computing,<br class="">that's a pretty compelling argument for supporting them.<br class=""><br class=""><blockquote type="cite" class="">I'd like to be able to represent any of those as<br class="">Intervals-which-are-now-Ranges. It makes sense to do so because the<br class="">things I want to do with them, such as clamping and testing if some<br class="">value is contained, are exactly what Intervals-now-Ranges provide.<br class="">Looking around, it seems many other languages provide only what Swift<br class="">currently does, but Perl does provide `..`, `..^`, `^..`, and `^..^`<br class="">(which, brought over to Swift, would be `...`, `..&lt;`, `&lt;..`, and<br class="">`&lt;.&lt;`).<br class=""></blockquote><br class="">Do we need fully-open ranges too?<br class=""></blockquote><br class="">I haven't encountered a need for open ranges, but I would expect that<br class="">other applications in scientific computing could make use of them.<br class="">I rather like Pyry's suggestions below.<span class="Apple-converted-space">&nbsp;</span><br class=""></blockquote><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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="">Below?</span><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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=""></div></blockquote></div><br class=""><div class="">Logically in time below.</div><div class=""><br class=""></div><div class="">I believe the following is a valid conversion of the Xiaodi Wu below into the Dave A domain.</div><div class=""><br class=""></div><div class=""><div class=""></div></div><blockquote type="cite" class=""><div class=""><div class="">On Apr 6, 2016, at 2:29 PM, Pyry Jahkola 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="" style="font-family: Palatino-Roman;">I&nbsp;think a sensible specification would be that with a positive step size, the count starts from the lower bound, and with a negative one, it starts from the upper bound (inclusive or exclusive). Thus, the following examples should cover all the corner cases:</div><div class="" style="font-family: Palatino-Roman;"><br class=""></div><div class="" style="font-family: Palatino-Roman;"><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 ... 9).striding(by: 2) == [0, 2, 4, 6, 8]</font></div><div class="" style="font-family: Palatino-Roman;"><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 ..&lt; 9).striding(by: 2) == [0, 2, 4, 6, 8]</font></div><div class="" style="font-family: Palatino-Roman;"><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 &lt;.. 9).striding(by: 2) == &nbsp; &nbsp;[2, 4, 6, 8]</font></div><div class="" style="font-family: Palatino-Roman;"><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 &lt;.&lt; 9).striding(by: 2) == &nbsp; &nbsp;[2, 4, 6, 8]</font></div><div class="" style="font-family: Palatino-Roman;"><font face="Menlo" class="" style="font-size: 11px;"><br class=""></font></div><div class="" style="font-family: Palatino-Roman;"><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 ... 9).striding(by: 3) == [0, 3, 6, 9]</font></div><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 ..&lt; 9).striding(by: 3) == [0, 3, 6]</font></div><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 &lt;.. 9).striding(by: 3) == &nbsp; &nbsp;[3, 6, 9]</font></div><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 &lt;.&lt; 9).striding(by: 3) == &nbsp; &nbsp;[3, 6]</font></div></div><div class="" style="font-family: Palatino-Roman;"><font face="Menlo" class="" style="font-size: 11px;"><br class=""></font></div><div class="" style="font-family: Palatino-Roman;"><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 ... 9).striding(by: -2) == [9, 7, 5, 3, 1]</font></div><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 ..&lt; 9).striding(by: -2) == &nbsp; &nbsp;[7, 5, 3, 1]</font></div><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 &lt;.. 9).striding(by: -2) == [9, 7, 5, 3, 1]</font></div><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 &lt;.&lt; 9).striding(by: -2) == &nbsp; &nbsp;[7, 5, 3, 1]</font></div><div class=""><font face="Menlo" class="" style="font-size: 11px;"><br class=""></font></div><div class=""><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 ... 9).striding(by: -3) == [9, 6, 3, 0]</font></div><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 ..&lt; 9).striding(by: -3) == &nbsp; &nbsp;[6, 3, 0]</font></div><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 &lt;.. 9).striding(by: -3) == [9, 6, 3]</font></div><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 &lt;.&lt; 9).striding(by: -3) == &nbsp; &nbsp;[6, 3]</font></div></div></div><div class="" style="font-family: Palatino-Roman;"><br class=""></div><div class="" style="font-family: Palatino-Roman;">Lastly, if you want the positive stride reversed, you'd do just that:</div><div class="" style="font-family: Palatino-Roman;"><br class=""></div><div class="" style="font-family: Palatino-Roman;"><div class=""><font face="Menlo" class="" style="font-size: 11px;">&nbsp; &nbsp; (0 ... 9).striding(by: 2).reverse() == [8, 6, 4, 2, 0]</font></div></div><div class="" style="font-family: Palatino-Roman;"><br class=""></div><div class="" style="font-family: Palatino-Roman;">— Pyry</div></div></div></blockquote><div class=""><br class=""></div></body></html>