Some explanation: Now that Julia thinks that Cube is an array, it assumes that these functions are defined. So when you call show, it will try to display it as an array. By the way I forgot the most important one: getindex(c::Cube, i...) = c.data[i...] setindex!(c::Cube, value, i...) = c.data[i...] = value
Am Samstag, 25. April 2015 13:50:52 UTC+2 schrieb Marcus Appelros: > > Consider the definitions: > > type Cubes<:AbstractArray > end > sum(cubes::Cubes)=sum(convert(Array,cubes).^3) > > Is it possible to make this work? To create a custom array that has > indexing and all at inception? Looked up the definition of Array and it is > in the commented section on types implemented in C, its constructor is a > ccall, if it isn't possible in pure julia would it be possible with C-code > that doesn't prompt a rebuild? >
