I'm implementing a collection of types that implement indexing, but where 
the indexes aren't necessarily bounded by `[1, size(collection, dim)]`. 
Some of them will have these bounds, but others will be indexable e.g. in 
`[0.5, size(collection, dim) + .5]` and yet others may have completely 
arbitrary bounds.

Is there a canonical name for methods that would return (the upper/lower) 
bounds for indexing? I am thinking along the lines of

```julia
lowerbound(v::Vector) = 1
upperbound(v::Vector) = length(v)
bounds(v::AbstractVector) = (lowerbound(v), upperbound(v))

lowerbound(A::Array, d::Int) = 1
upperbound(A::Array, d::Int) = size(A, d)
bounds(A::AbstractArray, d::Int) = (lowerbound(A, d), upperbound(A, d))

#etc...
```

but I'd rather add methods to an existing function, if there is one, than 
just make up my own.

(I did try a few searches in the docs, but everything I could find 
pertained to finding elements in collections...)

// T

Reply via email to