Are you sure that’s not just a typo between k and K (note the case difference)?
This works for me: J=10 K=3 MyArray = [Array(Int64,k) for k in 1:K, n in 1:binomial(J,K)] // T On Monday, September 21, 2015 at 10:08:13 AM UTC+2, Alan Crawford wrote: Hi, > > I'd like to be able to define an array of vectors where the number of > vectors in the array is linked to the length of the vector. For example, I > want to be define an array with say 10 scalars, 45 length 2 vectors, 120 > length 3 vectors, .... and so on. Intuitively, I thought the following code > might achieve this: > > J=10 > K=3 > MyArray = [Array(Int64,k) for k in 1:K, n in 1:binomial(J,k)] > > > However, it seems i cannot use k to define the number of element indexed > by n. > > I was wondering if anyone knew how to create the desired array? > > Thanks > Alan >
