[swift-evolution] [Proposal] Conventionalizing stride semantics
Erica Sadun
erica at ericasadun.com
Tue Mar 1 11:54:20 CST 2016
I'm adding in "upTo" as an alternative to "to". Reload in a minute or two.
-- E
> 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>*/
More information about the swift-evolution
mailing list