On Thursday, January 07, 2016 01:55:24 AM
cormu...@mac.com wrote:
> I wondered why there was no reshape!() function, just reshape().
Because reshape can change the type of the array, e.g., from Array{Float64,1}
to Array{Float64,2}. You can't change the type of an existing object.
> But in fact, a has changed:
>
> julia> for i = 1:8
> push!(a, i)
> end
> ERROR: cannot resize array with shared data
> in push! at array.jl:433
> [inlined code] from none:2
> in anonymous at no file:0
>
>
> Is there any way to tell a is now shared?
Not without writing a bit of C code. Follow the breadcrumbs from
@edit push!(a, 10)
to see why.
--Tim