What am I doing wrong with my parametric types?

I have this Cartesian product function

function cart_product{E}(n, A::Vector{Vector{E}})
  lengths = [length(a) for a in A]
  elems = Array(E, length(A))
  accum_lengths = Array(Integer, length(A))
  accum_lengths[1] = prod(lengths[2:])
  for i = 2:length(A)
    accum_lengths[i] = accum_lengths[i-1] / lengths[i]
  end
  
  cycle_lengths = [24/accum_lengths[i] for i = 1:length(A)]
  scales = cycle_lengths ./ lengths
  
  is = [div((n % cycle_lengths[i]),scales[i]) + 1 for i = 1:length(A)]
  
  for i = 1:length(A)
    elems[i] = A[i][is[i]]
  end
  elems
end



I am getting type errors with the either of the following

v = Array[["a", "b"],["c", "d", "e"],["f", "g", "h", "i"]]
v = Array[[1, 2],[3, 4, 5],[6, 7, 8, 9]]
cart_product(1,v)

cart_product` has no method matching cart_product(::Int64, 
::Array{Array{T,N},1})

What's going wrong here?

Reply via email to