We're partway through switching [] from concatenation to having it work the 
way you were expecting. But we need one release cycle with the deprecation 
warning (where it still concatenates) before we can make the switch.

--Tim

On Thursday, July 09, 2015 05:14:47 AM Scott Jones wrote:
> My son and I were scratching our heads a couple of days ago over just such
> a simple issue
> (but without even using comprehension [he's only 9 years old!]).
> 
> He'd tried to do:
> array = [ [ "David", 12 ], [ "Daniel", 12 ], [ "Alex", 9 ] ]
> but instead of giving an array of arrays, it got a deprecation warning
> about concatenation.
> I showed him how to do it with tuples, but the way that the syntax suddenly
> changes in Julia when you
> are within [ ] is very confusing.
> 
> Scott
> 
> On Thursday, July 9, 2015 at 8:05:36 AM UTC-4, Joachim Dahl wrote:
> > thank you, that's what I was looking for!
> > 
> > On Thu, Jul 9, 2015 at 2:00 PM, Yichao Yu <[email protected] <javascript:>>
> > 
> > wrote:
> >> On Thu, Jul 9, 2015 at 7:41 AM, Joachim Dahl <[email protected]
> >> 
> >> <javascript:>> wrote:
> >> > I am trying to construct an array of arrays involving list
> >> 
> >> comprehension in
> >> 
> >> > Julia 0.4
> >> > 
> >> > julia> [ [1,2]; [[i-1,i,i+1] for i=2:4] ]
> >> > 
> >> > 5-element Array{Any,1}:
> >> >  1
> >> >  2
> >> >  
> >> >   [1,2,3]
> >> >   [2,3,4]
> >> >   [3,4,5]
> >> 
> >> I never liked the hcat and vcat syntax but here's what you can do
> >> 
> >> julia> [Array[[1, 2]]; [[i - 1, i, i + 1] for i = 2:4]]
> >> 4-element Array{Array{T,N},1}:
> >> [1,2]
> >> [1,2,3]
> >> [2,3,4]
> >> [3,4,5]
> >> 
> >> You can probably add type Annotations to construct a tighter type ...
> >> 
> >> > where what I want is [ [1,2], [1,2,3], [2,3,4], [3,4,5] ].
> >> > 
> >> > I suppose I have to use T[ ] notation now, and I've tried:
> >> > julia> Array{Int,1}[ [1,2]; Array{Int,1}[[i-1,i,i+1] for i=2:4] ]
> >> > 
> >> > and other variations without any luck.
> >> > 
> >> > How would I construct such an array?

Reply via email to