[swift-evolution] Feature proposal: Range operator with step

Xiaodi Wu xiaodi.wu at gmail.com
Wed Apr 6 16:10:12 CDT 2016


On Wed, Apr 6, 2016 at 4:05 PM, Dave Abrahams <dabrahams at apple.com> wrote:
>
> on Wed Apr 06 2016, Xiaodi Wu <xiaodi.wu-AT-gmail.com> wrote:
>
>> On Wed, Apr 6, 2016 at 3:28 PM, Dave Abrahams via swift-evolution
>> <swift-evolution at swift.org> wrote:
>>> You if you need to represent `<..` intervals in scientific computing,
>>> that's a pretty compelling argument for supporting them.
>>>
>>>> I'd like to be able to represent any of those as
>>>> Intervals-which-are-now-Ranges. It makes sense to do so because the
>>>> things I want to do with them, such as clamping and testing if some
>>>> value is contained, are exactly what Intervals-now-Ranges provide.
>>>> Looking around, it seems many other languages provide only what Swift
>>>> currently does, but Perl does provide `..`, `..^`, `^..`, and `^..^`
>>>> (which, brought over to Swift, would be `...`, `..<`, `<..`, and
>>>> `<.<`).
>>>
>>> Do we need fully-open ranges too?
>>
>> I haven't encountered a need for open ranges, but I would expect that
>> other applications in scientific computing could make use of them.
>> I rather like Pyry's suggestions below.
>
> Below?

Sorry, chronologically, above; in terms of relative positions in the
thread, I think, below, since Pyry's suggests followed on from the
time I started writing. Ha, and Erica (above/below) just filled in
what I meant to say.


More information about the swift-evolution mailing list