{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/16260","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/16260/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/16260/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/16260/events","html_url":"https://github.com/JuliaLang/julia/pull/16260","id":153653507,"number":16260,"title":"Support for 0-indexed and arbitrary-indexed arrays","user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=3","gravatar_id":"","url":"https://api.github.com/users/timholy","html_url":"https://github.com/timholy","followers_url":"https://api.github.com/users/timholy/followers","following_url":"https://api.github.com/users/timholy/following{/other_user}","gists_url":"https://api.github.com/users/timholy/gists{/gist_id}","starred_url":"https://api.github.com/users/timholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timholy/subscriptions","organizations_url":"https://api.github.com/users/timholy/orgs","repos_url":"https://api.github.com/users/timholy/repos","events_url":"https://api.github.com/users/timholy/events{/privacy}","received_events_url":"https://api.github.com/users/timholy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":68,"created_at":"2016-05-08T12:34:56Z","updated_at":"2016-06-14T05:12:36Z","closed_at":"2016-06-14T05:04:06Z","pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/16260","html_url":"https://github.com/JuliaLang/julia/pull/16260","diff_url":"https://github.com/JuliaLang/julia/pull/16260.diff","patch_url":"https://github.com/JuliaLang/julia/pull/16260.patch"},"body":"This is the one part of [ArrayIteration.jl](https://github.com/timholy/ArrayIteration.jl) that I think it's reasonable to move to Base for the julia-0.5 release. The core change is the addition of the ~~`inds`~~`indices` function, which should be thought of as a sister function to `size` but instead returns a tuple containing the in-bounds indexes of an array. The fallback is\r\n```jl\r\nindices(A::AbstractArray, d) = 1:size(A,d)\r\nindices{T,N}(A::AbstractArray{T,N}) = ntuple(d->inds(A, d), Val{N})\r\n```\r\nBut this allows one to override `indices` for specific types:\r\n```jl\r\nA = OffsetArray([1 3; 2 4], (-1,2))\r\n@test A[0,3] == 1\r\n@test A[1,3] == 2\r\n@test A[0,4] == 3\r\n@test A[1,4] == 4\r\njulia> A[1,1]\r\nERROR: BoundsError: attempt to access OAs.OffsetArray{Int64,2,Array{Int64,2}} with inds (0:1,3:4):\r\n #undef  #undef\r\n #undef  #undef\r\n  at index [1,1]\r\n in throw_boundserror(::OAs.OffsetArray{Int64,2,Array{Int64,2}}, ::Tuple{Int64,Int64}) at ./abstractarray.jl:134\r\n [inlined code] from ./abstractarray.jl:103\r\n in getindex(::OAs.OffsetArray{Int64,2,Array{Int64,2}}, ::Int64, ::Int64) at /home/tim/src/julia-0.5/test/abstractarray.jl:542\r\n in eval(::Module, ::Any) at ./boot.jl:230\r\n```\r\n\r\nThis adds the definition and uses it in `checkbounds`. The bigger job will be wiring it into the rest of Base. So I thought I'd post at this stage and see what folks think."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/225781658","html_url":"https://github.com/JuliaLang/julia/pull/16260#issuecomment-225781658","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/16260","id":225781658,"user":{"login":"tkelman","id":5934628,"avatar_url":"https://avatars.githubusercontent.com/u/5934628?v=3","gravatar_id":"","url":"https://api.github.com/users/tkelman","html_url":"https://github.com/tkelman","followers_url":"https://api.github.com/users/tkelman/followers","following_url":"https://api.github.com/users/tkelman/following{/other_user}","gists_url":"https://api.github.com/users/tkelman/gists{/gist_id}","starred_url":"https://api.github.com/users/tkelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkelman/subscriptions","organizations_url":"https://api.github.com/users/tkelman/orgs","repos_url":"https://api.github.com/users/tkelman/repos","events_url":"https://api.github.com/users/tkelman/events{/privacy}","received_events_url":"https://api.github.com/users/tkelman/received_events","type":"User","site_admin":false},"created_at":"2016-06-14T05:12:36Z","updated_at":"2016-06-14T05:12:36Z","body":"had been wanting to review this more thoroughly, it is a *lot* of changed code. will do after the fact then."}}
{"actor":{"display_login":"tkelman"}}