Assigning to a view of an array

Thanks, very useful! I’ve bookmarked this usage.

I still don’t understand why there isn’t a functional API counterpart.
I tried some methods which doesn’t produce good results in terms of performance

import Random.seed! as seed!
N = 9999

seed!(1);
a = -rand(N, N);
seed!(2);
@time @. a = rand(); # 0.103707 seconds

seed!(1);
a = -rand(N, N);
seed!(2);
@time broadcast!(_ -> rand(), a, a); # 0.160028 seconds (150.04 k allocations: 7.617 MiB, 42.89% compilation time)

seed!(1);
a = -rand(N, N);
seed!(2);
@time foreach(i -> setindex!(a, rand(), i), eachindex(a)); # 3.865129 seconds (199.97 M allocations: 2.980 GiB, 19.73% gc time, 0.30% compilation time)

is the current sX .= f.() style (or @. sX = f()) very flexible then? I doubt this is something still to be determined.

My doubt is because, sometimes, I need to pass an address to an API:
for example, the last arg view(X, j) here is an address

Gurobi.GRBgetdblattrelement(o, "X", 
        Gurobi.c_column(o, JuMP.index(x[j])),
        view(X, j))

in my this post Efficiently Retrieving Variable Values after Gurobi optimization with JuMP - #23 by WalterMadelim.

In this circumstance I can’t figure out a way to use the highly efficient dot syntax.