Referenceables.jl

Author JuliaFolds2
Popularity
0 Stars
Updated Last
11 Months Ago
Started In
January 2024

Referenceables

Stable Dev Build Status Codecov Coveralls

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> 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