From 18f85de34aa9d04d54ef452e83d1e3ad2737db55 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Mon, 26 Feb 2024 12:54:28 -0500 Subject: [PATCH] better setall on tuples --- src/getsetall.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/getsetall.jl b/src/getsetall.jl index c69d83db..b5e3929d 100644 --- a/src/getsetall.jl +++ b/src/getsetall.jl @@ -69,7 +69,7 @@ function setall(obj, ::Properties, vs) end setall(obj::Tuple, ::Properties, vs) = setproperties(obj, vs) setall(obj::NamedTuple{NS}, ::Elements, vs) where {NS} = NamedTuple{NS}(NTuple{length(NS)}(vs)) -setall(obj::NTuple{N, Any}, ::Elements, vs) where {N} = (@assert length(vs) == N; NTuple{N}(vs)) +setall(obj::NTuple{N, Any}, ::Elements, vs) where {N} = (@assert length(vs) == N; ntuple(i -> vs[i], Val(N))) setall(obj::AbstractArray, ::Elements, vs::AbstractArray) = (@assert length(obj) == length(vs); reshape(vs, size(obj))) setall(obj::AbstractArray, ::Elements, vs) = setall(obj, Elements(), collect(vs)) setall(obj::Set, ::Elements, vs) = Set(vs)