Skip to content

Infinite length ranges inconsistently implemented #15562

@dlfivefifty

Description

@dlfivefifty

The following is inconsistent:

k=1:Inf
first(k)   # works
last(k)   # works
k[1]       # throws inexact error

In 0.5, show is also broken.

I would argue that infinite length ranges are worth implementing: it is more convenient to do

for k=1:Inf
   # do stuff and call break
end

than

k=1
while true
  # do stuff and call break
  k+=1
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    rangesEverything AbstractRange

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions