<div style="white-space:pre-wrap">Right. I would argue that `(a+s...b).striding(by: s).reversed` is a great deal less readable than `stride(from: b, to: a, by: -s)`. And since the latter is the status quo, I would say that it's a point against restricting strides to the proposed syntax.<br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Apr 5, 2016 at 3:57 PM Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
on Tue Apr 05 2016, Xiaodi Wu <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
<br>
> Certainly, for integer literals and strides of -1.<br>
><br>
> I meant more generally that removal of stride(...) will eliminate the<br>
> possibility of striding to but not through arbitrary half-open intervals (a, b],<br>
> where a < b, by a negative increment, because there is no such thing as `a>..b`<br>
> to express such an interval as a Swift range.<br>
> Of course, all such cases can be handled by adjusting the endpoint and using a<br>
> closed range instead<br>
><br>
<br>
Indeed, if b - a is a multiple of s,<br>
<br>
(a+s...b).striding(by: s).reversed<br>
<br>
works.<br>
<br>
The question is whether this case is important enough to create a<br>
special family of functions for, and then deal with the naming issues<br>
raised by<br>
<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0051-stride-semantics.md" rel="noreferrer" target="_blank">https://github.com/apple/swift-evolution/blob/master/proposals/0051-stride-semantics.md</a><br>
?<br>
<br>
> On Tue, Apr 5, 2016 at 2:54 PM Dave Abrahams<br>
> <<a href="mailto:dabrahams@apple.com" target="_blank">dabrahams@apple.com</a>> wrote:<br>
><br>
> on Tue Apr 05 2016, Xiaodi Wu <<a href="http://xiaodi.wu-AT-gmail.com" rel="noreferrer" target="_blank">xiaodi.wu-AT-gmail.com</a>> wrote:<br>
><br>
> > On Mon, Apr 4, 2016 at 1:22 PM, Dave Abrahams<br>
> <<a href="mailto:dabrahams@apple.com" target="_blank">dabrahams@apple.com</a>> wrote:<br>
> >><br>
> >> on Sat Apr 02 2016, Xiaodi Wu <<a href="http://xiaodi.wu-AT-gmail.com" rel="noreferrer" target="_blank">xiaodi.wu-AT-gmail.com</a>> wrote:<br>
> >><br>
> >>> [snip]<br>
> >>><br>
> >>> Not included:<br>
> >>> 1. I know Ranges are in flux, so I've held off on extending Range with<br>
> >>> a striding(by:) method in this proof-of-concept.<br>
> >><br>
> >> They're not in flux, except for not having been reviewed yet; they are<br>
> >> settled in the swift-3-indexing-model branch.<br>
> ><br>
> > Did not know that. Will have to study what's there in more detail.<br>
> ><br>
> >>> 2. No attempt at the suggested stride(from:to:steps:) quite yet.<br>
> >><br>
> >> #1 and #2 are mutually exclusive; we prefer #1 as it removes questions<br>
> >> about the meaning of "to" or "through."<br>
> ><br>
> > I wasn't aware that was the thinking. Limiting strides to<br>
> > `striding(by:)` removes the ability to express `stride(from: 0, to:<br>
> > -10, by: -1)`<br>
><br>
> IMO this:<br>
><br>
> (-9...0).reverse()<br>
><br>
> is better than<br>
><br>
> stride(from: 0, to: -10, by: -1)<br>
><br>
> What do you think?<br>
><br>
> --<br>
> Dave<br>
><br>
> _______________________________________________<br>
> swift-evolution mailing list<br>
> <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
--<br>
Dave<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>