I see, so similarly this works with any level of nesting:
julia> Array[[1,2],Array[[3],Array[[4],[6,7]]]]
2-element Array{Array{T,N},1}:
 [1,2]                      
 Array[[3],Array[[4],[6,7]]]

Thanks

On Sunday, May 17, 2015 at 12:59:28 PM UTC-7, Mauro wrote:
>
> This works: 
>
> julia> Array[[1,2],Array[[3],[4,5]]] 
> 2-element Array{Array{T,N},1}: 
>  [1,2]           
>  Array[[3],[4,5]] 
>
> (BTW, automatic concatenation is being changed in 0.4 & 0.5) 
>
> On Sun, 2015-05-17 at 21:41, Kuba Roth <[email protected] <javascript:>> 
> wrote: 
> > I've seen similar replies to my question on the forum but I still can't 
> > figure out how to initialize nested arrays of a depth higher then 2? 
> > 
> > For instance this works fine: 
> > julia> Array[[1,2],[3,4]] 
> > 2-element Array{Array{T,N},1}: 
> >  [1,2] 
> >  [3,4] 
> > 
> > 
> > But the following does not return what I expect. The [[3],[4,5]] part is 
> > "flattened" into a single array. 
> > julia> Array[[1,2],[[3],[4,5]]]   
> > 2-element Array{Array{T,N},1}: 
> >  [1,2]   
> >  [3,4,5] 
> > 
> > 
> > So far my workaround is to store the intermediate result and then assign 
> it 
> > to the final array. Can that be shortened to a single line? 
> > b = Array[[3],[4,5]]   
> > julia> Array[[1,2],b] 
> > 2-element Array{Array{T,N},1}: 
> >  [1,2]           
> >  Array[[3],[4,5]] 
> > 
> > 
> > Thank you. 
>
>

Reply via email to