Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make StarWarsArrays AbstractArray interface compliant #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mkitti
Copy link

@mkitti mkitti commented Feb 13, 2024

axes(A) should "Return a tuple of AbstractUnitRange{<:Integer}
of valid indices. The axes should be their own axes, that is
axes.(axes(A),1) == axes(A) should be satisfied."

Instead create a StarWarsArrays.axes and StarWarsArrays.eachindex

axes(A) should "Return a tuple of AbstractUnitRange{<:Integer}
of valid indices. The axes should be their own axes, that is
axes.(axes(A),1) == axes(A) should be satisfied."

Instead create a StarWarsArrays.axes and StarWarsArrays.eachindex
@mkitti
Copy link
Author

mkitti commented Feb 13, 2024

Demonstration

julia> using StarWarsArrays
Precompiling StarWarsArrays
  1 dependency successfully precompiled in 2 seconds

julia> a = StarWarsArray(1:9)
9-element view(::UnitRange{Int64}, [4, 5, 6, 1, 2, 3, 7, 8, 9]) with eltype Int64:
 4
 5
 6
 1
 2
 3
 7
 8
 9

julia> a[1]
4

julia> a[2]
5

julia> a[3]
6

julia> a[4]
1

julia> axes(a)
(Base.OneTo(9),)

julia> StarWarsArrays.axes(a)
([4, 5, 6, 1, 2, 3, 7, 8, 9],)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant