using StaticArrays
import Base.Cartesian: @ntuple
function times2(v::SVector{N, T}) where {N, T}
return SVector{N, T}(@ntuple N i->v[i]*2)
end
a = randn(SVector{3, Float64})
b = times2(a)
Does anyone know what I need to change to get this code to run? I’ve tried several things already, but always get the same error:
ERROR: LoadError: MethodError: no method matching var"@ntuple"(::LineNumberNode, ::Module, ::Symbol, ::Expr)
Closest candidates are:
var"@ntuple"(::LineNumberNode, ::Module, ::Int64, ::Any)
@ Base cartesian.jl:199