[swift-evolution] [Draft]: Introducing a striding(by:) method on 3.0 ranges
Jose Cheyo Jimenez
cheyo at masters3d.com
Mon Apr 11 00:30:23 CDT 2016
> On Apr 9, 2016, at 1:27 AM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
>
> On Sat, Apr 9, 2016 at 5:44 AM, Wallacy via swift-evolution
> <swift-evolution at swift.org> wrote:
>> Just as note, i think the sintax should be:
>>
>> 0...9
>> 0..<9
>> 0>..9
>> 0>.<9
I agree with this.
>>
>> Because the intention is produce a number bigger than 0 (start). So greater
>> than zero less than nine.
>
> That's not typically how it's written in math. When x is between two
> values a and b, it's written a < x < b. The pointy end of the symbol
> faces the smaller value. Here, 0 is the smaller value, so the pointy
> end must face it, as in `0 <.. 9` and `0 <.< 9`.
I don't agree with this and I bet this is why Perl uses ^ for that purpose.
Including these not yet proposed operators will be distracting to the review of the proposal. These discussions would be better served as their own proposed proposal.
I recommend removing any mention of them from this proposal.
>>
>>
>>
>>
>> Em sex, 8 de abr de 2016 22:50, Michel Fortin via swift-evolution
>> <swift-evolution at swift.org> escreveu:
>>>
>>> Le 8 avr. 2016 à 14:37, Erica Sadun via swift-evolution
>>> <swift-evolution at swift.org> a écrit :
>>>>
>>>> (0 ... 9).striding(by: -2) == [9, 7, 5, 3, 1]
>>>
>>> The above reads wrong to me. The expression has to be read differently
>>> depending on the tinny detail that is the sign of the step that comes last:
>>>
>>> * positive step: from 0 to 9 striding by 2
>>> * negative step: to 0 from 9 striding by -2
>>>
>>> Am I the only one thinking it's a bit too clever to swap the start and
>>> stop parts like this?
>>>
>>> --
>>> Michel Fortin
>>> https://michelf.ca
>>>
>>> _______________________________________________
>>> swift-evolution mailing list
>>> swift-evolution at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list