[swift-evolution] [Proposal] Conventionalizing stride semantics

Dave Abrahams dabrahams at apple.com
Thu Mar 3 09:05:59 CST 2016


on Tue Mar 01 2016, Erica Sadun <swift-evolution at swift.org> wrote:

> Please disregard previous reply. Just realized, what about 10..>1 by -1?  upTo: doesn't work there.

“Toward” doesn't work either unless the stride amount matches.

>> 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

-- 
-Dave



More information about the swift-evolution mailing list