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

Dave Abrahams dabrahams at apple.com
Wed Apr 6 16:05:22 CDT 2016

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. 



More information about the swift-evolution mailing list