[swift-evolution] [Proposal] Conventionalizing stride semantics

Dmitri Gribenko gribozavr at gmail.com
Tue Mar 1 11:52:17 CST 2016


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