-
Notifications
You must be signed in to change notification settings - Fork 5
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
Announcing IdentityRanges #1
Comments
Just curious — how do you view this in relation to Base.Slice? Is this meant to be substantially similar, but an official API with support for 0.5? As far as your opposite of the
|
Hah, I never really grokked that you could use
(complement, not inverse, right?) I thought of that. But the next sentence stopped me:
I think of AbstractArrays as being a special type of associative collection, where the keys are implicitly the indices. By this logic, |
Yeah, I see your point on I'd totally be on board with a better name for |
Now that I've thought about it a bit more, I'm less worried about In addition to julia> a = Base.Slice(-1:1)
Base.Slice(-1:1)
julia> a == -1:1 # this would be false with a = OffsetArray(-1:1, -1:1), because the indices have to match
true
julia> indices(reverse(a)) # I think this should return an array with the same indices
(Base.OneTo(3),) But reassuringly, things like
To me, their fundamental property is |
I'm not terribly surprised that there are bugs with I'll let you drive the Really |
I've decided it may be better/easier not to rely on Base.Slice, see the challenges discussed in JuliaLang/julia#21052. So I'm registering this, JuliaLang/METADATA.jl#8889. |
To watchers of JuliaArrays: here's a new package that makes it easy to "preserve" the indices of views. Please see the README. Any comments about implementation or tests would be of interest.
On a related note, there's an API question I'm struggling with, encapsulated by these tests currently marked broken (and which would be fixed if I uncommented this code). The question is, how should we "spell" the concept "please preserve the data but strip away the indices, returning something with indices that start with 1"? The clearest way to spell this is
But I'm wondering whether we want
convert(Array, a)
to be shorthand for that. The alternative viewpoint (the one we have now) is thatconvert(Array, a)
should succeed only if the indices ofa
start with 1. Feedback highly desired. Currently I lean towards the latter (more conservative) approach but I am noticing the lack of a convenient way of spelling this operation.There's also one test marked broken which appears to be a Julia bug (affecting
IndexLinear
SubArrays with non-1 indices). I haven't yet had time to dig into it, but will fix.The text was updated successfully, but these errors were encountered: