Julia: 1[end, end] errors: no multiarg lastindex for Numbers

Created on 16 Jun 2020  路  3Comments  路  Source: JuliaLang/julia

while silly, we should be constistent

julia> 1[1,1]
1

julia> 1[end]
1

julia> [1][end, end]
1

julia> 1[end, end]
ERROR: MethodError: no method matching lastindex(::Int64, ::Int64)
good first issue help wanted

Most helpful comment

You would just have to add a method lastindex(::Number, ::Int) here, probably adopt the bounds check from size and axes right above and then just return 1. Probably also a good idea to add a method to firstindex with the same defintion.

All 3 comments

I would like to work on this issue

You would just have to add a method lastindex(::Number, ::Int) here, probably adopt the bounds check from size and axes right above and then just return 1. Probably also a good idea to add a method to firstindex with the same defintion.

Thanks for the pointer @simeonschaub

Was this page helpful?
0 / 5 - 0 ratings