Setfield.jl
Setfield.jl copied to clipboard
Update deeply nested immutable structs.
```julia julia> μ = rand(2,2) 2×2 Matrix{Float64}: 0.943631 0.45465 0.0845643 0.781602 julia> Setfield.set(μ, @lens(_[1, :]), [0.0, 0.0]) 2×2 Matrix{Any}: 0.0 0.0 0.0845643 0.781602 ```
1.0 release
I think the API is pretty stable and the implementation is solid. What do you think about 1.0 @tkf ? Do you have any possible breaking changes in mind, we...
The single line: ``` setindex(a::StaticArrays.StaticArray, args...) = Base.setindex(a, args...) ``` Makes up most of the package's compile time; it could easily be moved to StaticArrays.jl, avoiding the cost of having...
Env: julia = 1.6.1 Setfield = 0.7.1 MWE: ```julia using Setfield struct C{S,T} i::T end c = C{Float64,Int}(1) d = C{Float64, Int}(2) Case 1: @set c.i = 2 #MethodError: no...
Not sure if you can specify your speech language, but if you can.. it may help some user.... Youtube seems to be confused.. see for instance at 2'41 into your...
```julia julia> x = Vector{Real}(undef, 2) 2-element Vector{Real}: #undef #undef julia> @set! x[1] = 1.0 ERROR: UndefRefError: access to undefined reference Stacktrace: [1] getindex @ ./array.jl:801 [inlined] [2] copy!(dst::Vector{Real}, src::Vector{Real})...
As part of the Julia Con proceedings, I would like to pubish this. I would be very happy to have you as a coauthor @tkf. Please go ahead and add...
`@set!` is awesome for StaticArrays, ```julia julia> x = @SVector(zeros(Int,3)) 3-element SVector{3, Int64} with indices SOneTo(3): 0 0 0 julia> @set x[1] = 1 3-element SVector{3, Int64} with indices SOneTo(3):...
Dear All, I am using setfield for indexing in terribly complicated tree structures naturally present in tree data. Since I frequently need programmatically adapt lenses, it helps a lot, if...
From time to time, I do an add hoc implementation of the following functionality: ```julia using Setfield import Setfield: modify """ modify(f, obj, obj1, obj2..., lens) Multi argument `modify`. Apply...