[swift-evolution] [Proposal] Conventionalizing stride semantics
Ross O'Brien
narrativium+swift at gmail.com
Tue Mar 1 12:03:08 CST 2016
A suggestion: "stride(approaching:by:)"
On Tue, Mar 1, 2016 at 5:55 PM, Erica Sadun via swift-evolution <
swift-evolution at swift.org> wrote:
> Please disregard previous reply. Just realized, what about 10..>1 by -1?
> upTo: doesn't work there.
>
> > On Mar 1, 2016, at 10:52 AM, Dmitri Gribenko <gribozavr at gmail.com>
> wrote:
> >
> > On Mon, Feb 29, 2016 at 5:14 PM, Erica Sadun via swift-evolution
> > <swift-evolution at swift.org> wrote:
> >> Style 1: [start, end) by interval
> >> This style is currently called to. I propose to rename it towards as
> each
> >> value works towards end. The final value in the progression is less
> than end
> >
> > The current usage of 'through' seems unambiguous to me. 'to' could be
> > improved by using 'upTo' instead.
> >
> > stride(from: 1, upTo: 10, by: 1) // [1, 10)
> >
> > 'upTo' is already precedented in Collection.prefix(upTo:).
> >
> > Dmitri
> >
> > --
> > main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> > (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160301/a9da10c4/attachment.html>
More information about the swift-evolution
mailing list