title: What is the best way to translate the generation of a multidimensional cell array from Matlab to Clojure
body: <p>I'm halfway through figuring out a solution to my question, but I have a feeling that it won't be very efficient.  I've got a 2 dimensional cell structure of variable length arrays that is constructed in a very non-functional way in Matlab that I would like to convert to Clojure.  Here is an example of what I'm trying to do:</p>
  
  <pre><code>pre = cell(N,1);
  aux = cell(N,1);
  for i=1:Ne
    for j=1:D
      for k=1:length(delays{i,j})
          pre{post(i, delays{i, j}(k))}(end+1) = N*(delays{i, j}(k)-1)+i;
          aux{post(i, delays{i, j}(k))}(end+1) = N*(D-1-j)+i; % takes into account delay
      end;
    end;
  end;
  </code></pre>
  
  <p>My current plan for implementation is to use 3 loops where the first is initialized with a vector of N vectors of an empty vector.  Each subloop is initialized by the previous loop.  I define a separate function that takes the overall vector and the subindices and value and returns the vector with an updated subvector.  </p>
  
  <p>There's got to be a smarter way of doing this than using 3 loop/recurs.  Possibly some reduce function that simplifies the syntax by using an accumulator.  </p>