Le mercredi 09 mars 2016 à 01:41 -0800, jw3126 a écrit :
> I want to construct an immutable parametrized by a number dim, which
> has a field of type Tuple{Int64, Int64, ... } where Int64 is repeated
> dim times. I tried
>
> immutable SomeType{dim}
> x :: Tuple{repeat([Int64], outer = [dim])...}
> end
>
> However this gives the following error:
>
> LoadError: TypeError: typeassert: expected Array{Int64,N}, got
> Array{TypeVar,1}
> while loading In[8], in expression starting on line 1
>
> What is the recommended way to construct such a type?
Try this:
immutable SomeType{N}
x::NTuple{N, Int64}
end
Regards