# Custom Indices in OffsetArrays

**URL:** <https://discourse.julialang.org/t/custom-indices-in-offsetarrays/22886>\
**Category:** New to Julia\
**Created:** [April 7, 2019, 6:53pm UTC](https://discourse.julialang.org/t/custom-indices-in-offsetarrays/22886 "2019-04-07T18:53:12Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [April 8, 2019, 6:08am UTC](https://discourse.julialang.org/t/custom-indices-in-offsetarrays/22886/3 "2019-04-08T06:08:51Z")

</div>

> [@OvidiusCicero](#):
>
> Is it possible to declare an array whose indices leave out every second index, eg such that the set of indices is `0,2,4,6` ?

No, this violates the current interface, ie that `axes` returns a `Tuple` of `AbstractUnitRange` objects, which have a step of `1`. See this discussion:

> [@Custom index arithmetic](https://discourse.julialang.org/t/custom-index-arithmetic/14374):
>
> This is a clarifying question about [custom indexing](https://docs.julialang.org/en/stable/devdocs/offset-arrays/#man-custom-indices-1). If x::AbstractVector has a conforming interface, can I assume that that the valid indexes are firstindex(x):lastindex(x), ie they are integers (so nothing wacky like Float64s or Symbol), forming a contiguous range, so I can do arithmetic on them, at least index += some\_step. This is for an algorithm that I find difficult to express in an iterator form using eachindex. Sorry if this is obvious and already clearly discussed in the manual.

---

_[View the full topic](https://discourse.julialang.org/t/custom-indices-in-offsetarrays/22886)._
