https://github.com/tkf/referenceables.jl
https://github.com/tkf/referenceables.jl
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tkf/referenceables.jl
- Owner: tkf
- License: mit
- Created: 2019-07-11T21:48:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-07-19T23:26:21.000Z (over 4 years ago)
- Last Synced: 2025-03-27T20:20:01.353Z (10 months ago)
- Language: Julia
- Size: 135 KB
- Stars: 15
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Referenceables
[](https://tkf.github.io/Referenceables.jl/stable)
[](https://tkf.github.io/Referenceables.jl/dev)
[](https://travis-ci.com/tkf/Referenceables.jl)
[](https://codecov.io/gh/tkf/Referenceables.jl)
[](https://coveralls.io/github/tkf/Referenceables.jl?branch=master)
Referenceables.jl provides an interface for readable and writable
reference to an element of an array or dictionary. The entry point
function is `referenceable`. Wrapping a container `x` yields a new
view `y = referenceable(x)` to `x` where indexing to it yields a
reference `r = y[i]`. This reference can be used to read `value =
r[]` or write `r[] = value` a value.
## Examples
```julia
julia> using Referenceables
julia> x = collect(reshape(1:6, (2, 3)))
y = referenceable(x);
julia> r = y[1, 1] :: Ref
↪1
julia> r[] = 100;
julia> x
2×3 Array{Int64,2}:
100 3 5
2 4 6
```