https://github.com/juliaarrays/endpointranges.jl
Julia package for doing arithmetic on endpoints in array indexing
https://github.com/juliaarrays/endpointranges.jl
Last synced: 7 months ago
JSON representation
Julia package for doing arithmetic on endpoints in array indexing
- Host: GitHub
- URL: https://github.com/juliaarrays/endpointranges.jl
- Owner: JuliaArrays
- License: other
- Created: 2016-07-26T13:19:14.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-09-04T22:53:04.000Z (almost 3 years ago)
- Last Synced: 2025-02-13T20:17:25.612Z (over 1 year ago)
- Language: Julia
- Size: 25.4 KB
- Stars: 23
- Watchers: 5
- Forks: 10
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# EndpointRanges
[](https://travis-ci.org/JuliaArrays/EndpointRanges.jl)
[](http://codecov.io/github/JuliaArrays/EndpointRanges.jl?branch=master)
This Julia package makes it easier to index "unconventional" arrays
(ones for which indexing does not necessarily start at 1), by defining
constants `ibegin` and `iend` that stand for the beginning and end,
respectively, of the indices range along any given dimension.
# Usage
```jl
using EndpointRanges
a = 1:20
a[ibegin:iend] == a
a[ibegin+3:iend-2] == a[4:18]
a[1:(ibegin+iend)÷2] == a[1:10]
```
Note that, unlike `3:end` you can also pass such indices as arguments to a function:
```
view(a, ibegin+2:iend-3) == view(a, 3:17)
```