Generator as an "Array Initializer?"

This may be used to create an OffsetArray as well, by providing offset axes as the loop indices.

julia> using OffsetArrays

julia> collect(Float64, i+j for i in 1:3, j in Base.IdentityUnitRange(2:4))
3×3 OffsetArray(::Matrix{Float64}, 1:3, 2:4) with eltype Float64 with indices 1:3×2:4:
 3.0  4.0  5.0
 4.0  5.0  6.0
 5.0  6.0  7.0
1 Like