Thank you everyone, and my apologies for turning this thread into a tutorial. I do have one last question:
We know the field generator
is a function so why give it a generic type parameter? So for example, instead of
struct IndexFunArray{T, N, F} <: AbstractArray{T, N} where {F}
# stores the generator function to be applied to the indices.
generator::F
end
isn’t it better to do
struct IndexFunArray{T, N} <: AbstractArray{T, N}
# stores the generator function to be applied to the indices.
generator::Function
end