Vectorized updating operator?

Is it possible to vectorize an updating operator? This gives an error

a,b,c = (10,20,30)
a,b,c ./=10
julia> x = [10.0, 20.0, 30.0]
3-element Array{Float64,1}:
 10.0
 20.0
 30.0

julia> x ./= 10
3-element Array{Float64,1}:
 1.0
 2.0
 3.0

julia> x
3-element Array{Float64,1}:
 1.0
 2.0
 3.0

Updating operators can be broadcasted, your code example doesn’t work because tuples are immutable and cannot be updated.

2 Likes

Thanks. Makes sense

abc = (10,20,30)
abc = abc./10

Perhaps?

Also consider StaticArrays.jl if your tuple is to behave like a vector.

2 Likes