I have a function f
which takes in x::AbstractArray
. My function returns another function g
(a closure). Inside g
, I do not need x
, but I need to construct similar(x)
.
Therefore, so that I do not to waste memory by closing over the entire array, I would not like g
to close over x
, but just close over sufficient information so that I can construct the equivalent of similar(x)
inside g
. Does the AbstractArray
interface support this (fairly well-motivated) use case?